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

playbook: Prove that any host is ok for the server

By adding Host: HTTP/1.1 header and checking the response the test
asserts, that server is able to serve on any hostname, which is
configured to server's IP address.
parent f01aae91
...@@ -20,3 +20,18 @@ class TestSiteHttp(unittest.TestCase): ...@@ -20,3 +20,18 @@ class TestSiteHttp(unittest.TestCase):
self.assertEqual(result.status_code, 302) self.assertEqual(result.status_code, 302)
self.assertTrue(result.headers['Location'].endswith('/erp5/login_form')) self.assertTrue(result.headers['Location'].endswith('/erp5/login_form'))
self.assertTrue(result.headers['Location'].startswith('https://')) self.assertTrue(result.headers['Location'].startswith('https://'))
def test_http_erp5_anydomain(self):
"""Checks that any domain can be used"""
result = requests.get(
self.http_url + '/erp5/', allow_redirects=False,
headers={'Host': 'anyhost'}
)
self.assertTrue(result.ok)
self.assertTrue(result.is_redirect)
self.assertFalse(result.is_permanent_redirect)
self.assertEqual(result.status_code, 302)
self.assertEqual(
result.headers['Location'],
'https://anyhost/erp5/'
)
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