Commit f01aae91 authored by Łukasz Nowak's avatar Łukasz Nowak

playbook: Improve HTTP test

Do not redirect during request, just assert that redirection is
correctly returned form the server.
parent ec5388f3
......@@ -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://'))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment