def test_get_full_url_without_schema(self): settings.SITE_PROTOCOL = 'https' m = Meta() self.assertEqual( m.get_full_url('//foo.com/foo/bar'), 'https://foo.com/foo/bar' )
def test_get_full_url_without_schema(self): meta.settings.SITE_PROTOCOL = 'https' m = Meta() self.assertEqual( m.get_full_url('//foo.com/foo/bar'), 'https://foo.com/foo/bar' )
def test_get_full_url_with_absolute_path(self): meta.settings.SITE_PROTOCOL = 'https' meta.settings.SITE_DOMAIN = 'foo.com' m = Meta() self.assertEqual( m.get_full_url('/foo/bar'), 'https://foo.com/foo/bar' )
def test_get_full_url_with_domain_and_protocol(self): meta.settings.SITE_PROTOCOL = 'https' meta.settings.SITE_DOMAIN = 'foo.com' m = Meta() self.assertEqual( m.get_full_url('foo/bar'), 'https://foo.com/foo/bar' )
def test_get_full_url_without_site_id_with_request_will_not_raise(self): settings.USE_SITES = True settings.SITE_PROTOCOL = 'http' factory = RequestFactory() request = factory.get('/') Site.objects.create(domain=request.get_host()) m = Meta(request=request) self.assertEqual(m.get_full_url('foo/bar'), 'http://testserver/foo/bar')
def test_get_full_url_without_site_id_with_request_will_not_raise(self): settings.USE_SITES = True settings.SITE_PROTOCOL = 'http' factory = RequestFactory() request = factory.get('/') Site.objects.create(domain=request.get_host()) m = Meta(request=request) self.assertEqual( m.get_full_url('foo/bar'), 'http://testserver/foo/bar' )
def test_get_full_url_without_domain_will_raise(self): meta.settings.SITE_PROTOCOL = 'http' m = Meta() with self.assertRaises(ImproperlyConfigured): m.get_full_url('foo/bar')
def test_get_full_url_without_protocol_will_raise(self): m = Meta() with self.assertRaises(ImproperlyConfigured): m.get_full_url('foo/bar')
def test_get_full_url_with_full_url(self): m = Meta() self.assertEqual( m.get_full_url('http://example.com/foo'), 'http://example.com/foo' )
def test_get_full_url_with_None(self): m = Meta() self.assertEqual(m.get_full_url(None), None)
def test_get_full_url_without_site_id_will_raise(self): settings.USE_SITES = True settings.SITE_PROTOCOL = 'http' m = Meta() with self.assertRaises(ImproperlyConfigured): m.get_full_url('foo/bar')
def test_get_full_url_with_absolute_path(self): meta.settings.SITE_PROTOCOL = "https" meta.settings.SITE_DOMAIN = "foo.com" m = Meta() self.assertEqual(m.get_full_url("/foo/bar"), "https://foo.com/foo/bar")
def test_get_full_url_with_domain_and_protocol(self): meta.settings.SITE_PROTOCOL = "https" meta.settings.SITE_DOMAIN = "foo.com" m = Meta() self.assertEqual(m.get_full_url("foo/bar"), "https://foo.com/foo/bar")