From bca820589e405495d3100c1e417d22eddc887aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Wed, 13 Apr 2022 20:45:24 +0200 Subject: [PATCH 1/2] Update flask and jinja2 --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index b843d892..e768689c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ certifi==2021.10.8 babel==2.9.1 flask-babel==2.0.0 -flask==2.0.2 -jinja2==3.0.3 +flask==2.1.1 +jinja2==3.1.1 lxml==4.7.1 pygments==2.8.0 python-dateutil==2.8.2 From 3abf6204187ea589d756d00976f794ea4f935d3f Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Fri, 1 Apr 2022 10:27:41 +0200 Subject: [PATCH 2/2] [fix] issue when upgrading from werkzeug v2.0.3 to v2.1.0 In v2.1.0 werkzeug [1] fixed an issue [2] to keep relative redirect locations by default [3]. Since relative locations are returned, we need to fix out test cases to avoid AssertionErrors like this one:: ====================================================================== FAIL: test_index_html_get (tests.unit.test_webapp.ViewsTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/runner/work/searxng/searxng/tests/unit/test_webapp.py", line 105, in test_index_html_get self.assertEqual(result.location, 'http://localhost/search?q=test') AssertionError: '/search?q=test' != 'http://localhost/search?q=test' - /search?q=test + http://localhost/search?q=test [1] https://werkzeug.palletsprojects.com/ [2] https://github.com/pallets/werkzeug/issues/2352 fixed in [3] https://github.com/pallets/werkzeug/pull/2354 Related-to: https://github.com/searxng/searxng/pull/1039#issuecomment-1085538288 Signed-off-by: Markus Heiser --- tests/unit/test_webapp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/test_webapp.py b/tests/unit/test_webapp.py index 21a5763f..f865ef03 100644 --- a/tests/unit/test_webapp.py +++ b/tests/unit/test_webapp.py @@ -90,12 +90,12 @@ class ViewsTestCase(SearxTestCase): def test_index_html_post(self): result = self.app.post('/', data={'q': 'test'}) self.assertEqual(result.status_code, 308) - self.assertEqual(result.location, 'http://localhost/search') + self.assertEqual(result.location, '/search') def test_index_html_get(self): result = self.app.post('/?q=test') self.assertEqual(result.status_code, 308) - self.assertEqual(result.location, 'http://localhost/search?q=test') + self.assertEqual(result.location, '/search?q=test') def test_search_empty_html(self): result = self.app.post('/search', data={'q': ''})