def test_get_scheme_if_not_secure_ssl_redirect(self): absolute_uri = AbsoluteURI('test', 'test') self.assertEqual('http', absolute_uri.get_scheme())
def test_get_path(self, mock_reverse): absolute_uri = AbsoluteURI('test namespace', 'test url name') absolute_uri.get_path() mock_reverse.assert_called_with('test namespace:test url name')
def test_get_host_exception(self): del settings.DJANGO_TWILIO_SMS_SITE_HOST absolute_uri = AbsoluteURI('test', 'test') with self.assertRaises(ImproperlyConfigured): absolute_uri.get_host()
def test_get_host_no_exception(self): absolute_uri = AbsoluteURI('test', 'test') self.assertEqual('www.test.com', absolute_uri.get_host())
def test_get_absolute_uri(self, mock_reverse): mock_reverse.return_value = '/test/' absolute_uri = AbsoluteURI('test', 'test') self.assertEqual('https://www.test.com/test/', absolute_uri.get_absolute_uri())
def test_init(self): namespace = 'test namespace' url_name = 'test url name' absolute_uri = AbsoluteURI(namespace, url_name) self.assertEqual(namespace, absolute_uri.namespace) self.assertEqual(url_name, absolute_uri.url_name)