diff --git a/test/server.cpp b/test/server.cpp index 65c1376a8..e82dd676e 100644 --- a/test/server.cpp +++ b/test/server.cpp @@ -411,11 +411,13 @@ public: std::string expectedResponse() const; private: + bool isTranslatedVersion() const; virtual std::string pageTitle() const; std::string pageCssLink() const; std::string hiddenBookNameInput() const; std::string searchPatternInput() const; std::string taskbarLinks() const; + std::string goToWelcomePageText() const; }; std::string TestContentIn404HtmlResponse::expectedResponse() const @@ -454,7 +456,11 @@ std::string TestContentIn404HtmlResponse::expectedResponse() const
- + )FRAG", R"FRAG( @@ -478,10 +484,14 @@ std::string TestContentIn404HtmlResponse::expectedResponse() const + frag[3] + searchPatternInput() + frag[4] - + taskbarLinks() + + goToWelcomePageText() + frag[5] - + removeEOLWhitespaceMarkers(expectedBody) - + frag[6]; + + goToWelcomePageText() + + frag[6] + + taskbarLinks() + + frag[7] + + expectedBody + + frag[8]; } std::string TestContentIn404HtmlResponse::pageTitle() const @@ -538,6 +548,19 @@ std::string TestContentIn404HtmlResponse::taskbarLinks() const + R"(">)"; } +bool TestContentIn404HtmlResponse::isTranslatedVersion() const +{ + return url.find("userlang=hy") != std::string::npos; +} + +std::string TestContentIn404HtmlResponse::goToWelcomePageText() const +{ + return isTranslatedVersion() + ? "Գրադարանի էջ" + : "Go to welcome page"; +} + + class TestContentIn400HtmlResponse : public TestContentIn404HtmlResponse { public: @@ -556,7 +579,6 @@ std::string TestContentIn400HtmlResponse::pageTitle() const { : expectedPageTitle; } - } // namespace TestingOfHtmlResponses TEST_F(ServerTest, 404WithBodyTesting)