src/utils_oauth_test.c: Fix oauth_create_google_json test.
authorFlorian Forster <octo@collectd.org>
Sat, 20 Jun 2015 06:53:24 +0000 (08:53 +0200)
committerFlorian Forster <octo@collectd.org>
Thu, 4 Oct 2018 19:14:36 +0000 (21:14 +0200)
src/utils_oauth_test.c

index 09c46e1..6087344 100644 (file)
@@ -117,21 +117,26 @@ DEF_TEST(oauth_create_google_json) {
       "\"client_x509_cert_url\":\"https://www.googleapis.com/robot/v1/"
       "metadata/x509/example-sacct%40ssc-serv-dev.iam.gserviceaccount.com\"}";
 
-  oauth_t *ret =
+  oauth_google_t ret =
       oauth_create_google_json(in, "https://collectd.org/example.scope");
-  CHECK_NOT_NULL(ret);
 
+  EXPECT_EQ_STR("collectd.org:unit-test", ret.project_id);
+
+  CHECK_NOT_NULL(ret.oauth);
   struct {
     char *url;
     char *iss;
     char *aud;
     char *scope;
-  } *obj = (void *)ret;
+  } *obj = (void *)ret.oauth;
 
   EXPECT_EQ_STR("https://accounts.google.com/o/oauth2/token", obj->url);
   EXPECT_EQ_STR("example-sacct@unit-test.iam.gserviceaccount.com", obj->iss);
   EXPECT_EQ_STR("https://collectd.org/example.scope", obj->scope);
 
+  free(ret.project_id);
+  oauth_destroy(ret.oauth);
+
   return 0;
 }