summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2023-01-11 16:04:05 +0100
committerRoland Reichwein <mail@reichwein.it>2023-01-11 16:04:05 +0100
commitd1ecca18d97238aa6312c85521f1a4874699f1c4 (patch)
tree864d381c9fe90b6dc7a4fa581120b2c38c5308b2 /tests
parente679b0241662ea7c1910b9fc02ed0cb8f59b0de6 (diff)
Added tests, example configuration
Diffstat (limited to 'tests')
-rw-r--r--tests/test-webserver.cpp17
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);
+}