summaryrefslogtreecommitdiff
path: root/tests/unit/test_webapp.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-08-17 08:18:30 +0200
committerAlexandre Flament <alex@al-f.net>2021-08-17 08:18:30 +0200
commit28ccf47ca464a0477b5d156f0328ca9d811b2a24 (patch)
tree29ed1d43b7f7715469368cb09349450b52cd2c47 /tests/unit/test_webapp.py
parenta925254c3d19c6a3badf43469816fc1b497e2990 (diff)
downloadsearxng-28ccf47ca464a0477b5d156f0328ca9d811b2a24.tar.gz
searxng-28ccf47ca464a0477b5d156f0328ca9d811b2a24.zip
[mod] searx.webapp.get_locale: read locale from the preferences
pre_request already set the locale.
Diffstat (limited to 'tests/unit/test_webapp.py')
-rw-r--r--tests/unit/test_webapp.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit/test_webapp.py b/tests/unit/test_webapp.py
index 2cbdc83d6..8598113f7 100644
--- a/tests/unit/test_webapp.py
+++ b/tests/unit/test_webapp.py
@@ -220,6 +220,24 @@ class ViewsTestCase(SearxTestCase):
'Search language ignored browser preference.'
)
+ def test_brower_empty_locale(self):
+ result = self.app.get('/preferences', headers={'Accept-Language': ''})
+ self.assertEqual(result.status_code, 200)
+ self.assertIn(
+ b'<option value="en" selected="selected">',
+ result.data,
+ 'Interface locale ignored browser preference.'
+ )
+
+ def test_locale_occitan(self):
+ result = self.app.get('/preferences?locale=oc')
+ self.assertEqual(result.status_code, 200)
+ self.assertIn(
+ b'<option value="oc" selected="selected">',
+ result.data,
+ 'Interface locale ignored browser preference.'
+ )
+
def test_stats(self):
result = self.app.get('/stats')
self.assertEqual(result.status_code, 200)