From c57b8a0c7c949c17a341e76d8e22bd2536425ff8 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Tue, 5 Dec 2023 17:50:26 +0400 Subject: [PATCH] Testing of HTTPErrorResponse translation --- test/response.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/response.cpp b/test/response.cpp index c65691b8d..cbfbfd3d7 100644 --- a/test/response.cpp +++ b/test/response.cpp @@ -46,3 +46,30 @@ R"( )"); } + +TEST(HTTPErrorResponse, shouldBeTranslatable) { + const RequestContext req = makeHttpGetRequest("/asdf", + /* headers */ {}, + /* query args */ {{"userlang", "test"}} + ); + + HTTPErrorResponse errResp(req, MHD_HTTP_NOT_FOUND, + "404-page-title", + "404-page-heading", + "/css/error.css"); + + EXPECT_EQ(getResponseContent(errResp), +R"( + + + + [I18N TESTING] Not Found - Try Again + + + +

[I18N TESTING] Content not found, but at least the server is alive

+ + + +)"); +}