diff options
| author | Roland Reichwein <mail@reichwein.it> | 2023-01-11 16:04:05 +0100 | 
|---|---|---|
| committer | Roland Reichwein <mail@reichwein.it> | 2023-01-11 16:04:05 +0100 | 
| commit | d1ecca18d97238aa6312c85521f1a4874699f1c4 (patch) | |
| tree | 864d381c9fe90b6dc7a4fa581120b2c38c5308b2 | |
| parent | e679b0241662ea7c1910b9fc02ed0cb8f59b0de6 (diff) | |
Added tests, example configuration
| -rw-r--r-- | TODO | 3 | ||||
| -rw-r--r-- | debian/webserver.docs | 2 | ||||
| -rw-r--r-- | debian/webserver.example-websocket.conf | 26 | ||||
| -rw-r--r-- | tests/test-webserver.cpp | 17 | 
4 files changed, 44 insertions, 4 deletions
| @@ -1,8 +1,7 @@  example conf files: -- websockets  - php +- fcgi  test: -- bad config  - FCGI  Big file bug  - dynamic plugin interface (file buffer, ...) diff --git a/debian/webserver.docs b/debian/webserver.docs index 0b7c406..ea758e8 100644 --- a/debian/webserver.docs +++ b/debian/webserver.docs @@ -1,2 +1,2 @@  README.txt -webserver.example-cgi.conf +debian/webserver.example-*.conf diff --git a/debian/webserver.example-websocket.conf b/debian/webserver.example-websocket.conf new file mode 100644 index 0000000..06d8676 --- /dev/null +++ b/debian/webserver.example-websocket.conf @@ -0,0 +1,26 @@ +<webserver> + <user>www-data</user> + <group>www-data</group> + <threads>10</threads> + <statisticspath>/var/lib/webserver/stats.db</statisticspath> + <plugin-directory>/usr/lib/webserver/plugins</plugin-directory> + <sites> +  <site> +   <name>localhost</name> +   <host>localhost</host> +   <host>[::1]</host> +   <path requested="/"> +    <plugin>websocket</plugin> +    <target>::1:8765</target> +   </path> +  </site> + </sites> + <sockets> +  <socket> +   <address>::1</address> +   <port>8080</port> +   <protocol>http</protocol> +   <site>localhost</site> +  </socket> + </sockets> +</webserver> 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); +} | 
