Added unit tests for SSLServer::bind_to_any_port
This commit is contained in:
parent
3fe13ecc91
commit
d61d63dd97
13
test/test.cc
13
test/test.cc
@ -645,11 +645,22 @@ TEST(HttpsToHttpRedirectTest, Redirect) {
|
|||||||
|
|
||||||
TEST(Server, BindAndListenSeparately) {
|
TEST(Server, BindAndListenSeparately) {
|
||||||
Server svr;
|
Server svr;
|
||||||
int port = svr.bind_to_any_port("localhost");
|
int port = svr.bind_to_any_port("0.0.0.0");
|
||||||
|
ASSERT_TRUE(svr.is_valid());
|
||||||
ASSERT_TRUE(port > 0);
|
ASSERT_TRUE(port > 0);
|
||||||
svr.stop();
|
svr.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
|
TEST(SSLServer, BindAndListenSeparately) {
|
||||||
|
SSLServer svr(SERVER_CERT_FILE, SERVER_PRIVATE_KEY_FILE, CLIENT_CA_CERT_FILE, CLIENT_CA_CERT_DIR);
|
||||||
|
int port = svr.bind_to_any_port("0.0.0.0");
|
||||||
|
ASSERT_TRUE(svr.is_valid());
|
||||||
|
ASSERT_TRUE(port > 0);
|
||||||
|
svr.stop();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
class ServerTest : public ::testing::Test {
|
class ServerTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
ServerTest()
|
ServerTest()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user