Skip to content

Commit

Permalink
Added UTs
Browse files Browse the repository at this point in the history
Signed-off-by: Athish Pranav D <athishanna@gmail.com>
  • Loading branch information
Athishpranav2003 committed Sep 10, 2024
1 parent 8f5e379 commit b1d63b3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/extensions/filters/http/common/jwks_fetcher_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,28 @@ TEST_F(JwksFetcherTest, TestGetSuccess) {
fetcher_->fetch(parent_span_, receiver);
}

TEST_F(JwksFetcherTest, TestMessageHeader) {
// Setup
setupFetcher(config);
MockUpstream mock_pubkey(mock_factory_ctx_.server_factory_context_.cluster_manager_, "200",
publicKey);
MockJwksReceiver receiver;

// Expectations for message
EXPECT_CALL(mock_factory_ctx_.server_factory_context_.cluster_manager_.thread_local_cluster_
.async_client_,
send_(_, _, _))
.WillOnce(Invoke([](Http::RequestMessagePtr& message, Http::AsyncClient::Callbacks&,
const Http::AsyncClient::RequestOptions&) -> Http::AsyncClient::Request* {
EXPECT_EQ(message->headers().getUserAgentValue(),
Http::Headers::get().UserAgentValues.GoBrowser);
return nullptr;
}));

// Act
fetcher_->fetch(parent_span_, receiver);
}

TEST_F(JwksFetcherTest, TestGet400) {
// Setup
setupFetcher(config);
Expand Down

0 comments on commit b1d63b3

Please sign in to comment.