Skip to content

Commit

Permalink
Add test cases for http-client retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
ayeshLK committed Jun 17, 2021
1 parent 691e8b1 commit bc3fb81
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions websub-ballerina/tests/utils_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -397,3 +397,27 @@ isolated function testRequestHeadersRetrievalWithoutHeaderValue() returns @taint
test:assertEquals(response.getContentType(), mime:APPLICATION_FORM_URLENCODED);
test:assertEquals(decodedPayload.get("Message"), "Header Not Found");
}

@test:Config {
groups: ["httpClientRetrieval"]
}
isolated function testRetrieveHttpClientWithConfig() returns @tainted error? {
http:ClientConfiguration httpsConfig = {
secureSocket: {
cert: {
path: "tests/resources/ballerinaTruststore.pkcs12",
password: "ballerina"
}
}
};
http:Client clientEp = check retrieveHttpClient("https://test.com/sample", httpsConfig);
test:assertTrue(clientEp is http:Client);
}

@test:Config {
groups: ["httpClientRetrieval"]
}
isolated function testRetrieveHttpClientWithoutConfig() returns @tainted error? {
http:Client clientEp = check retrieveHttpClient("https://test.com/sample", ());
test:assertTrue(clientEp is http:Client);
}

0 comments on commit bc3fb81

Please sign in to comment.