Index: google_apis/google_api_keys_unittest.cc |
diff --git a/google_apis/google_api_keys_unittest.cc b/google_apis/google_api_keys_unittest.cc |
index 5ce1fb31622d454e1099f49a73cb6f669487adf0..a645649ed88d929d752445311fbc45f2b2ed1aae 100644 |
--- a/google_apis/google_api_keys_unittest.cc |
+++ b/google_apis/google_api_keys_unittest.cc |
@@ -481,4 +481,56 @@ TEST_F(GoogleAPIKeysTest, OverrideAllKeysUsingEnvironment) { |
EXPECT_EQ("env-SECRET_REMOTING_HOST", secret_remoting_host); |
} |
+TEST_F(GoogleAPIKeysTest, OverrideAllKeysUsingSetters) { |
Eugene But (OOO till 7-30)
2017/04/19 16:27:14
Could you please add a comment explaining what thi
jzw1
2017/04/20 07:59:49
Done.
|
+ namespace testcase = google_apis; |
+ |
+ std::string api_key("setter-API_KEY"); |
Eugene But (OOO till 7-30)
2017/04/19 16:27:14
Would it be better to split this test into multipl
jzw1
2017/04/20 07:59:49
I feel like this test is set up in a very similar
|
+ testcase::SetAPIKey(api_key); |
+ |
+ std::string id_main("setter-ID_MAIN"); |
+ std::string secret_main("setter-SECRET_MAIN"); |
+ testcase::SetOAuth2ClientID(testcase::CLIENT_MAIN, id_main); |
+ testcase::SetOAuth2ClientSecret(testcase::CLIENT_MAIN, secret_main); |
+ |
+ std::string id_cloud_print("setter-ID_CLOUD_PRINT"); |
+ std::string secret_cloud_print("setter-SECRET_CLOUD_PRINT"); |
+ testcase::SetOAuth2ClientID(testcase::CLIENT_CLOUD_PRINT, id_cloud_print); |
+ testcase::SetOAuth2ClientSecret(testcase::CLIENT_CLOUD_PRINT, |
+ secret_cloud_print); |
+ |
+ std::string id_remoting("setter-ID_REMOTING"); |
+ std::string secret_remoting("setter-SECRET_REMOTING"); |
+ testcase::SetOAuth2ClientID(testcase::CLIENT_REMOTING, id_remoting); |
+ testcase::SetOAuth2ClientSecret(testcase::CLIENT_REMOTING, secret_remoting); |
+ |
+ std::string id_remoting_host("setter-ID_REMOTING_HOST"); |
+ std::string secret_remoting_host("setter-SECRET_REMOTING_HOST"); |
+ testcase::SetOAuth2ClientID(testcase::CLIENT_REMOTING_HOST, id_remoting_host); |
+ testcase::SetOAuth2ClientSecret(testcase::CLIENT_REMOTING_HOST, |
+ secret_remoting_host); |
+ |
+ EXPECT_TRUE(testcase::HasKeysConfigured()); |
+ |
+ EXPECT_EQ(api_key, testcase::GetAPIKey()); |
+ |
+ EXPECT_EQ(id_main, testcase::GetOAuth2ClientID(testcase::CLIENT_MAIN)); |
+ EXPECT_EQ(secret_main, |
+ testcase::GetOAuth2ClientSecret(testcase::CLIENT_MAIN)); |
+ |
+ EXPECT_EQ(id_cloud_print, |
+ testcase::GetOAuth2ClientID(testcase::CLIENT_CLOUD_PRINT)); |
+ EXPECT_EQ(secret_cloud_print, |
+ testcase::GetOAuth2ClientSecret(testcase::CLIENT_CLOUD_PRINT)); |
+ |
+ EXPECT_EQ(id_remoting, |
+ testcase::GetOAuth2ClientID(testcase::CLIENT_REMOTING)); |
+ EXPECT_EQ(secret_remoting, |
+ testcase::GetOAuth2ClientSecret(testcase::CLIENT_REMOTING)); |
+ |
+ EXPECT_EQ(id_remoting_host, |
+ testcase::GetOAuth2ClientID(testcase::CLIENT_REMOTING_HOST)); |
+ EXPECT_EQ(secret_remoting_host, |
+ testcase::GetOAuth2ClientSecret(testcase::CLIENT_REMOTING_HOST)); |
+} |
Roger Tawa OOO till Jul 10th
2017/04/19 18:32:20
Doesn't this test need to be inside an #ifdef for
jzw1
2017/04/20 07:59:49
Oh dear god yes. Thanks for catching that.
|
+ |
#endif // defined(OS_LINUX) || defined(OS_MACOSX) |