Пример #1
0
 def test_get_server_url_with_https_and_port(self):
     req = MagicMock()
     req.META = {'SERVER_NAME': 'foo.com', 'SERVER_PORT': '8443'}
     req.is_secure = MagicMock(return_value=True)
     res = views._get_server_url(req)
     self.assertEqual('https://foo.com:8443', res)
Пример #2
0
 def test_get_server_url_with_http_alt_port(self):
     req = MagicMock()
     req.META = {'SERVER_NAME': 'foo.com', 'SERVER_PORT': '8000'}
     req.is_secure = MagicMock(return_value=False)
     res = views._get_server_url(req)
     self.assertEqual('http://foo.com:8000', res)