diff --git a/test/data/poor.zim b/test/data/poor.zim new file mode 100644 index 000000000..b30d77a18 Binary files /dev/null and b/test/data/poor.zim differ diff --git a/test/meson.build b/test/meson.build index 62b210871..1047ff0c7 100644 --- a/test/meson.build +++ b/test/meson.build @@ -29,6 +29,7 @@ if gtest_dep.found() and not meson.is_cross_build() 'zimfile.zim', 'zimfile&other.zim', 'corner_cases.zim', + 'poor.zim', 'library.xml' ] foreach file : data_files diff --git a/test/server.cpp b/test/server.cpp index 59ed29bb4..6467d44fa 100644 --- a/test/server.cpp +++ b/test/server.cpp @@ -142,6 +142,7 @@ protected: const int PORT = 8001; const ZimFileServer::FilePathCollection ZIMFILES { "./test/zimfile.zim", + "./test/poor.zim", "./test/corner_cases.zim" }; @@ -761,6 +762,31 @@ TEST_F(ServerTest, 400WithBodyTesting) } } +TEST_F(ServerTest, 500) +{ + const std::string expectedBody = R"( + +
+ ++ An internal server error occured. We are sorry about that :/ +
++ Entry redirect_loop.html is a redirect entry. +
+ + +)"; + + const auto r = zfs1_->GET("/ROOT/poor/A/redirect_loop.html"); + EXPECT_EQ(r->status, 500); + EXPECT_EQ(r->body, expectedBody); +} + TEST_F(ServerTest, RandomPageRedirectsToAnExistingArticle) { auto g = zfs1_->GET("/ROOT/random?content=zimfile");