@@ -26,6 +26,7 @@ namespace {
2626using ::google::cloud::internal::UnavailableError;
2727using ::google::cloud::testing_util::IsOk;
2828using ::google::cloud::testing_util::IsOkAndHolds;
29+ using ::testing::Contains;
2930using ::testing::IsEmpty;
3031using ::testing::Not;
3132using ::testing::Pair;
@@ -43,8 +44,9 @@ TEST(Credentials, AuthorizationHeaderSuccess) {
4344 auto const expiration = now + std::chrono::seconds (3600 );
4445 EXPECT_CALL (mock, GetToken (now))
4546 .WillOnce (Return (AccessToken{" test-token" , expiration}));
46- auto actual = mock.AuthenticationHeader (now);
47- EXPECT_THAT (actual, IsOkAndHolds (Pair (" Authorization" , " Bearer test-token" )));
47+ auto actual = mock.AuthenticationHeaders (now);
48+ EXPECT_THAT (actual, IsOkAndHolds (Contains (rest_internal::HttpHeader (
49+ " authorization" , " Bearer test-token" ))));
4850}
4951
5052TEST (Credentials, AuthenticationHeaderJoinedSuccess) {
@@ -53,8 +55,8 @@ TEST(Credentials, AuthenticationHeaderJoinedSuccess) {
5355 auto const expiration = now + std::chrono::seconds (3600 );
5456 EXPECT_CALL (mock, GetToken (now))
5557 .WillOnce (Return (AccessToken{" test-token" , expiration}));
56- auto actual = AuthenticationHeaderJoined (mock, now);
57- EXPECT_THAT (actual, IsOkAndHolds (" Authorization : Bearer test-token" ));
58+ auto actual = AuthenticationHeadersJoined (mock, now);
59+ EXPECT_THAT (actual, IsOkAndHolds (" authorization : Bearer test-token" ));
5860}
5961
6062TEST (Credentials, AuthenticationHeaderJoinedEmpty) {
@@ -63,21 +65,21 @@ TEST(Credentials, AuthenticationHeaderJoinedEmpty) {
6365 auto const expiration = now + std::chrono::seconds (3600 );
6466 EXPECT_CALL (mock, GetToken (now))
6567 .WillOnce (Return (AccessToken{" " , expiration}));
66- auto actual = AuthenticationHeaderJoined (mock, now);
68+ auto actual = AuthenticationHeadersJoined (mock, now);
6769 EXPECT_THAT (actual, IsOkAndHolds (IsEmpty ()));
6870}
6971
7072TEST (Credentials, AuthenticationHeaderError) {
7173 MockCredentials mock;
7274 EXPECT_CALL (mock, GetToken).WillOnce (Return (UnavailableError (" try-again" )));
73- auto actual = mock.AuthenticationHeader (std::chrono::system_clock::now ());
75+ auto actual = mock.AuthenticationHeaders (std::chrono::system_clock::now ());
7476 EXPECT_EQ (actual.status (), UnavailableError (" try-again" ));
7577}
7678
7779TEST (Credentials, AuthenticationHeaderJoinedError) {
7880 MockCredentials mock;
7981 EXPECT_CALL (mock, GetToken).WillOnce (Return (UnavailableError (" try-again" )));
80- auto actual = AuthenticationHeaderJoined (mock);
82+ auto actual = AuthenticationHeadersJoined (mock);
8183 EXPECT_EQ (actual.status (), UnavailableError (" try-again" ));
8284}
8385
0 commit comments