diff --git a/test/server.cpp b/test/server.cpp index aea76793..fd29ee68 100644 --- a/test/server.cpp +++ b/test/server.cpp @@ -1107,15 +1107,25 @@ TEST_F(ServerTest, UserLanguageControl) /* expected

*/ "Not Found" }, { - "The value of the Accept-Language header is not currently parsed.", + "Most suitable language is selected from the Accept-Language header", // In case of a comma separated list of languages (optionally weighted - // with quality values) the default (en) language is used instead. + // with quality values) the most suitable language is selected. /*url*/ "/ROOT/content/zimfile/invalid-article", /*Accept-Language:*/ "test;q=0.9, en;q=0.2", /*Request Cookie:*/ NO_COOKIE, /*Response Set-Cookie:*/ "userlang=test", /* expected

*/ "[I18N TESTING] Content not found, but at least the server is alive" }, + { + "Most suitable language is selected from the Accept-Language header", + // In case of a comma separated list of languages (optionally weighted + // with quality values) the most suitable language is selected. + /*url*/ "/ROOT/content/zimfile/invalid-article", + /*Accept-Language:*/ "test;q=0.2, en;q=0.9", + /*Request Cookie:*/ NO_COOKIE, + /*Response Set-Cookie:*/ "userlang=en", + /* expected

*/ "Not Found" + }, }; const std::regex h1Regex("

(.+)

"); @@ -1130,6 +1140,7 @@ TEST_F(ServerTest, UserLanguageControl) } const auto r = zfs1_->GET(t.url.c_str(), headers); if ( t.responseSetCookie ) { + ASSERT_TRUE(r->has_header("Set-Cookie")) << t; EXPECT_EQ(t.responseSetCookie, getHeaderValue(r->headers, "Set-Cookie")) << t; } else { EXPECT_FALSE(r->has_header("Set-Cookie"));