Пример #1
0
 def test_get_scheme_if_not_secure_ssl_redirect(self):
     absolute_uri = AbsoluteURI('test', 'test')
     self.assertEqual('http', absolute_uri.get_scheme())
Пример #2
0
 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')
Пример #3
0
 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()
Пример #4
0
 def test_get_host_no_exception(self):
     absolute_uri = AbsoluteURI('test', 'test')
     self.assertEqual('www.test.com', absolute_uri.get_host())
Пример #5
0
 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())
Пример #6
0
 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)