forked from zaclys/searxng
[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 <markus.heiser@darmarit.de>
This commit is contained in:
parent
fd67df7d7c
commit
6c747c40c1
|
@ -97,12 +97,12 @@ class ViewsTestCase(SearxTestCase):
|
||||||
def test_index_html_post(self):
|
def test_index_html_post(self):
|
||||||
result = self.app.post('/', data={'q': 'test'})
|
result = self.app.post('/', data={'q': 'test'})
|
||||||
self.assertEqual(result.status_code, 308)
|
self.assertEqual(result.status_code, 308)
|
||||||
self.assertEqual(result.location, 'http://localhost/search')
|
self.assertEqual(result.location, '/search')
|
||||||
|
|
||||||
def test_index_html_get(self):
|
def test_index_html_get(self):
|
||||||
result = self.app.post('/?q=test')
|
result = self.app.post('/?q=test')
|
||||||
self.assertEqual(result.status_code, 308)
|
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):
|
def test_search_empty_html(self):
|
||||||
result = self.app.post('/search', data={'q': ''})
|
result = self.app.post('/search', data={'q': ''})
|
||||||
|
|
Loading…
Reference in New Issue