def test_http_nonstandard_port(self): result = get_host({ 'wsgi.url_scheme': 'http', 'SERVER_NAME': 'example.com', 'SERVER_PORT': '81', }) self.assertEquals(result, 'example.com:81')
def test_https_strips_port(self): result = get_host({ 'wsgi.url_scheme': 'https', 'SERVER_NAME': 'example.com', 'SERVER_PORT': '443', }) self.assertEquals(result, 'example.com')
def test_http_host(self): result = get_host({'HTTP_HOST': 'example.com'}) self.assertEquals(result, 'example.com')
def test_http_x_forwarded_host(self): result = get_host({'HTTP_X_FORWARDED_HOST': 'example.com'}) self.assertEquals(result, 'example.com')