Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Huabing Zhao <[email protected]>
  • Loading branch information
zhaohuabing committed Jan 10, 2025
1 parent 72795d6 commit 8c3abb6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/extensions/filters/http/oauth2/oauth_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ TEST_F(OAuth2ClientTest, RequestAccessTokenSuccess) {
}));

client_->setCallbacks(*mock_callbacks_);
client_->asyncGetAccessToken("a", "b", "c", "d");
client_->asyncGetAccessToken("a", "b", "c", "d", "e");
EXPECT_EQ(1, callbacks_.size());
EXPECT_CALL(*mock_callbacks_, onGetAccessTokenSuccess("golden ticket", _, _, 1000s));
Http::MockAsyncClientRequest request(&cm_.thread_local_cluster_.async_client_);
Expand Down Expand Up @@ -133,7 +133,7 @@ TEST_F(OAuth2ClientTest, RequestAccessTokenMissingExpiresIn) {
}));

client_->setCallbacks(*mock_callbacks_);
client_->asyncGetAccessToken("a", "b", "c", "d");
client_->asyncGetAccessToken("a", "b", "c", "d", "e");
EXPECT_EQ(1, callbacks_.size());
EXPECT_CALL(*mock_callbacks_, sendUnauthorizedResponse());
Http::MockAsyncClientRequest request(&cm_.thread_local_cluster_.async_client_);
Expand Down Expand Up @@ -169,7 +169,7 @@ TEST_F(OAuth2ClientTest, RequestAccessTokenDefaultExpiresIn) {
uri.mutable_timeout()->set_seconds(1);
client_ = std::make_shared<OAuth2ClientImpl>(cm_, uri, absl::nullopt, 2000s);
client_->setCallbacks(*mock_callbacks_);
client_->asyncGetAccessToken("a", "b", "c", "d");
client_->asyncGetAccessToken("a", "b", "c", "d", "e");
EXPECT_EQ(1, callbacks_.size());
EXPECT_CALL(*mock_callbacks_, onGetAccessTokenSuccess("golden ticket", _, _, 2000s));
Http::MockAsyncClientRequest request(&cm_.thread_local_cluster_.async_client_);
Expand Down Expand Up @@ -200,7 +200,7 @@ TEST_F(OAuth2ClientTest, RequestAccessTokenIncompleteResponse) {
}));

client_->setCallbacks(*mock_callbacks_);
client_->asyncGetAccessToken("a", "b", "c", "d");
client_->asyncGetAccessToken("a", "b", "c", "d", "e");
EXPECT_EQ(1, callbacks_.size());
EXPECT_CALL(*mock_callbacks_, sendUnauthorizedResponse());
Http::MockAsyncClientRequest request(&cm_.thread_local_cluster_.async_client_);
Expand All @@ -225,7 +225,7 @@ TEST_F(OAuth2ClientTest, RequestAccessTokenErrorResponse) {
}));

client_->setCallbacks(*mock_callbacks_);
client_->asyncGetAccessToken("a", "b", "c", "d");
client_->asyncGetAccessToken("a", "b", "c", "d", "e");
EXPECT_EQ(1, callbacks_.size());
EXPECT_CALL(*mock_callbacks_, sendUnauthorizedResponse());
Http::MockAsyncClientRequest request(&cm_.thread_local_cluster_.async_client_);
Expand Down Expand Up @@ -256,7 +256,7 @@ TEST_F(OAuth2ClientTest, RequestAccessTokenInvalidResponse) {
}));

client_->setCallbacks(*mock_callbacks_);
client_->asyncGetAccessToken("a", "b", "c", "d");
client_->asyncGetAccessToken("a", "b", "c", "d", "e");
EXPECT_EQ(1, callbacks_.size());
EXPECT_CALL(*mock_callbacks_, sendUnauthorizedResponse());
Http::MockAsyncClientRequest request(&cm_.thread_local_cluster_.async_client_);
Expand All @@ -274,7 +274,7 @@ TEST_F(OAuth2ClientTest, RequestAccessTokenNetworkError) {
}));

client_->setCallbacks(*mock_callbacks_);
client_->asyncGetAccessToken("a", "b", "c", "d");
client_->asyncGetAccessToken("a", "b", "c", "d", "e");
EXPECT_EQ(1, callbacks_.size());

EXPECT_CALL(*mock_callbacks_, sendUnauthorizedResponse());
Expand Down Expand Up @@ -302,7 +302,7 @@ TEST_F(OAuth2ClientTest, RequestAccessTokenUnhealthyUpstream) {

client_->setCallbacks(*mock_callbacks_);
EXPECT_CALL(*mock_callbacks_, sendUnauthorizedResponse());
client_->asyncGetAccessToken("a", "b", "c", "d");
client_->asyncGetAccessToken("a", "b", "c", "d", "e");
}

TEST_F(OAuth2ClientTest, RequestRefreshAccessTokenSuccess) {
Expand Down Expand Up @@ -479,7 +479,7 @@ TEST_F(OAuth2ClientTest, NoCluster) {
ON_CALL(cm_, getThreadLocalCluster("auth")).WillByDefault(Return(nullptr));
client_->setCallbacks(*mock_callbacks_);
EXPECT_CALL(*mock_callbacks_, sendUnauthorizedResponse());
client_->asyncGetAccessToken("a", "b", "c", "d");
client_->asyncGetAccessToken("a", "b", "c", "d", "e");
EXPECT_EQ(0, callbacks_.size());
}

Expand Down Expand Up @@ -523,7 +523,7 @@ TEST_F(OAuth2ClientTest, RequestAccessTokenRetryPolicy) {
}));

client_->setCallbacks(*mock_callbacks_);
client_->asyncGetAccessToken("a", "b", "c", "d");
client_->asyncGetAccessToken("a", "b", "c", "d", "e");
}

} // namespace Oauth2
Expand Down

0 comments on commit 8c3abb6

Please sign in to comment.