From f01aae9186f93e2a866b4b02c28111ecec7ed31e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com> Date: Wed, 17 May 2017 11:45:11 +0200 Subject: [PATCH] playbook: Improve HTTP test Do not redirect during request, just assert that redirection is correctly returned form the server. --- playbook/roles/standalone-shared/tests/testSiteHttp.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/playbook/roles/standalone-shared/tests/testSiteHttp.py b/playbook/roles/standalone-shared/tests/testSiteHttp.py index c4ce053..e20e2d3 100644 --- a/playbook/roles/standalone-shared/tests/testSiteHttp.py +++ b/playbook/roles/standalone-shared/tests/testSiteHttp.py @@ -11,10 +11,12 @@ class TestSiteHttp(unittest.TestCase): def test_http_erp5_login_form(self): """Check that accessing site over HTTP redirects to HTTPS""" - result = requests.get(self.http_url + '/erp5/login_form', verify=False) + result = requests.get( + self.http_url + '/erp5/login_form', verify=False, + allow_redirects=False) self.assertTrue(result.ok) self.assertTrue(result.is_redirect) - self.assertTrue(result.is_permanent_redirect) + self.assertFalse(result.is_permanent_redirect) self.assertEqual(result.status_code, 302) self.assertTrue(result.headers['Location'].endswith('/erp5/login_form')) self.assertTrue(result.headers['Location'].startswith('https://')) -- 2.30.9