Testing of HTTPErrorResponse translation

This commit is contained in:
Veloman Yunkan 2023-12-05 17:50:26 +04:00
parent aee6c23082
commit c57b8a0c7c
1 changed files with 27 additions and 0 deletions

View File

@ -46,3 +46,30 @@ R"(<!DOCTYPE html>
</html> </html>
)"); )");
} }
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"(<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html;charset=UTF-8" http-equiv="content-type" />
<title>[I18N TESTING] Not Found - Try Again</title>
<link type="text/css" href="/css/error.css" rel="Stylesheet" />
</head>
<body>
<h1>[I18N TESTING] Content not found, but at least the server is alive</h1>
</body>
</html>
)");
}