mirror of https://github.com/kiwix/libkiwix.git
Added error details in testing of error responses
This commit is contained in:
parent
b151a2a480
commit
d2fedf9123
|
@ -32,6 +32,12 @@ TEST(HTTPErrorResponse, shouldBeInEnglishByDefault) {
|
||||||
"/css/error.css",
|
"/css/error.css",
|
||||||
/*includeKiwixResponseData=*/true);
|
/*includeKiwixResponseData=*/true);
|
||||||
|
|
||||||
|
errResp += ParameterizedMessage("suggest-search",
|
||||||
|
{
|
||||||
|
{ "PATTERN", "asdf" },
|
||||||
|
{ "SEARCH_URL", "/search?q=asdf" }
|
||||||
|
});
|
||||||
|
|
||||||
EXPECT_EQ(getResponseContent(errResp),
|
EXPECT_EQ(getResponseContent(errResp),
|
||||||
R"(<!DOCTYPE html>
|
R"(<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
@ -40,12 +46,14 @@ R"(<!DOCTYPE html>
|
||||||
<title>Content not found</title>
|
<title>Content not found</title>
|
||||||
<link type="text/css" href="/css/error.css" rel="Stylesheet" />
|
<link type="text/css" href="/css/error.css" rel="Stylesheet" />
|
||||||
<script>
|
<script>
|
||||||
const KIWIX_RESPONSE_DATA = { "CSS_URL" : "/css/error.css", "PAGE_HEADING" : { "msgid" : "404-page-heading", "params" : { } }, "PAGE_TITLE" : { "msgid" : "404-page-title", "params" : { } }, "details" : [ ] };
|
const KIWIX_RESPONSE_DATA = { "CSS_URL" : "/css/error.css", "PAGE_HEADING" : { "msgid" : "404-page-heading", "params" : { } }, "PAGE_TITLE" : { "msgid" : "404-page-title", "params" : { } }, "details" : [ { "p" : { "msgid" : "suggest-search", "params" : { "PATTERN" : "asdf", "SEARCH_URL" : "/search?q=asdf" } } } ] };
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Not Found</h1>
|
<h1>Not Found</h1>
|
||||||
|
<p>
|
||||||
|
Make a full text search for <a href="/search?q=asdf">asdf</a>
|
||||||
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
)");
|
)");
|
||||||
|
@ -63,6 +71,12 @@ TEST(HTTPErrorResponse, shouldBeTranslatable) {
|
||||||
"/css/error.css",
|
"/css/error.css",
|
||||||
/*includeKiwixResponseData=*/true);
|
/*includeKiwixResponseData=*/true);
|
||||||
|
|
||||||
|
errResp += ParameterizedMessage("suggest-search",
|
||||||
|
{
|
||||||
|
{ "PATTERN", "asdf" },
|
||||||
|
{ "SEARCH_URL", "/search?q=asdf" }
|
||||||
|
});
|
||||||
|
|
||||||
EXPECT_EQ(getResponseContent(errResp),
|
EXPECT_EQ(getResponseContent(errResp),
|
||||||
R"(<!DOCTYPE html>
|
R"(<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
@ -71,12 +85,14 @@ R"(<!DOCTYPE html>
|
||||||
<title>[I18N TESTING] Not Found - Try Again</title>
|
<title>[I18N TESTING] Not Found - Try Again</title>
|
||||||
<link type="text/css" href="/css/error.css" rel="Stylesheet" />
|
<link type="text/css" href="/css/error.css" rel="Stylesheet" />
|
||||||
<script>
|
<script>
|
||||||
const KIWIX_RESPONSE_DATA = { "CSS_URL" : "/css/error.css", "PAGE_HEADING" : { "msgid" : "404-page-heading", "params" : { } }, "PAGE_TITLE" : { "msgid" : "404-page-title", "params" : { } }, "details" : [ ] };
|
const KIWIX_RESPONSE_DATA = { "CSS_URL" : "/css/error.css", "PAGE_HEADING" : { "msgid" : "404-page-heading", "params" : { } }, "PAGE_TITLE" : { "msgid" : "404-page-title", "params" : { } }, "details" : [ { "p" : { "msgid" : "suggest-search", "params" : { "PATTERN" : "asdf", "SEARCH_URL" : "/search?q=asdf" } } } ] };
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>[I18N TESTING] Content not found, but at least the server is alive</h1>
|
<h1>[I18N TESTING] Content not found, but at least the server is alive</h1>
|
||||||
|
<p>
|
||||||
|
[I18N TESTING] Make a full text search for <a href="/search?q=asdf">asdf</a>
|
||||||
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
)");
|
)");
|
||||||
|
|
Loading…
Reference in New Issue