diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-webserver.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/test-webserver.cpp b/tests/test-webserver.cpp index f23b8cd..e9e6df5 100644 --- a/tests/test-webserver.cpp +++ b/tests/test-webserver.cpp @@ -441,7 +441,7 @@ BOOST_DATA_TEST_CASE_F(Fixture, http_get_file_not_found, data::make({false, true BOOST_REQUIRE(!fs::exists("./webserver.confSUFFIX")); auto response{(https ? HTTPS("/webserver.confSUFFIX", ipv6, http11, method) : HTTP("/webserver.confSUFFIX", ipv6, http11, method))}; BOOST_REQUIRE(serverProcess.is_running()); - BOOST_REQUIRE_EQUAL(response.first, fmt::format("HTTP/{} 404 Not Found\r\nServer: Reichwein.IT Webserver " VERSION "\r\nContent-Type: text/html\r\nContent-Length: {}\r\n\r\n", http11 ? "1.1" : "1.0", method == boost::beast::http::verb::head ? 0 : 36)); + BOOST_REQUIRE_EQUAL(response.first, fmt::format("HTTP/{} 404 Not Found\r\nServer: Reichwein.IT Webserver " VERSION "\r\nContent-Type: text/plain\r\nContent-Length: {}\r\n\r\n", http11 ? "1.1" : "1.0", method == boost::beast::http::verb::head ? 0 : 36)); BOOST_REQUIRE_EQUAL(response.second, method == boost::beast::http::verb::head ? "" : "404 Not found: /webserver.confSUFFIX"); } @@ -1050,3 +1050,18 @@ echo -ne "HTTP_HOST: $HTTP_HOST\r\n" BOOST_CHECK_EQUAL(result.second, "500 Bad Script: test2.sh/path1"); } +BOOST_FIXTURE_TEST_CASE(empty_config, Fixture) +{ + WebserverProcess serverProcess{""}; + BOOST_REQUIRE_EQUAL(serverProcess.is_running(), false); +} + +BOOST_FIXTURE_TEST_CASE(incomplete_config, Fixture) +{ + std::string webserver_config{R"CONFIG(<webserver> + <user>www-data</user> + <group>www-data</group> +</webserver>)CONFIG"}; + WebserverProcess serverProcess{webserver_config}; + BOOST_REQUIRE_EQUAL(serverProcess.is_running(), false); +} |