unittest / specify a cacert for tls client tests
This commit is contained in:
parent
55141aa875
commit
bf46f3fe8f
@ -55,6 +55,10 @@ TEST_CASE("http_client", "[http]")
|
|||||||
HttpClient httpClient;
|
HttpClient httpClient;
|
||||||
WebSocketHttpHeaders headers;
|
WebSocketHttpHeaders headers;
|
||||||
|
|
||||||
|
SocketTLSOptions tlsOptions;
|
||||||
|
tlsOptions.caFile = "cacert.pem";
|
||||||
|
httpClient.setTLSOptions(tlsOptions);
|
||||||
|
|
||||||
std::string url("https://httpbin.org/");
|
std::string url("https://httpbin.org/");
|
||||||
auto args = httpClient.createRequest(url);
|
auto args = httpClient.createRequest(url);
|
||||||
|
|
||||||
@ -94,6 +98,10 @@ TEST_CASE("http_client", "[http]")
|
|||||||
HttpClient httpClient(async);
|
HttpClient httpClient(async);
|
||||||
WebSocketHttpHeaders headers;
|
WebSocketHttpHeaders headers;
|
||||||
|
|
||||||
|
SocketTLSOptions tlsOptions;
|
||||||
|
tlsOptions.caFile = "cacert.pem";
|
||||||
|
httpClient.setTLSOptions(tlsOptions);
|
||||||
|
|
||||||
std::string url("https://httpbin.org/");
|
std::string url("https://httpbin.org/");
|
||||||
auto args = httpClient.createRequest(url);
|
auto args = httpClient.createRequest(url);
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ TEST_CASE("socket", "[socket]")
|
|||||||
std::string errMsg;
|
std::string errMsg;
|
||||||
bool tls = true;
|
bool tls = true;
|
||||||
SocketTLSOptions tlsOptions;
|
SocketTLSOptions tlsOptions;
|
||||||
|
tlsOptions.caFile = "cacert.pem";
|
||||||
std::shared_ptr<Socket> socket = createSocket(tls, errMsg, tlsOptions);
|
std::shared_ptr<Socket> socket = createSocket(tls, errMsg, tlsOptions);
|
||||||
std::string host("www.google.com");
|
std::string host("www.google.com");
|
||||||
int port = 443;
|
int port = 443;
|
||||||
|
@ -47,6 +47,10 @@ namespace
|
|||||||
{
|
{
|
||||||
_webSocket.setUrl(url);
|
_webSocket.setUrl(url);
|
||||||
|
|
||||||
|
SocketTLSOptions tlsOptions;
|
||||||
|
tlsOptions.caFile = "cacert.pem";
|
||||||
|
_webSocket.setTLSOptions(tlsOptions);
|
||||||
|
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
log(std::string("Connecting to url: ") + url);
|
log(std::string("Connecting to url: ") + url);
|
||||||
|
|
||||||
|
4430
test/cacert.pem
Normal file
4430
test/cacert.pem
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user