Exemplo n.º 1
0
 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'
     )
Exemplo n.º 2
0
 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'
     )
Exemplo n.º 3
0
 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'
     )
Exemplo n.º 4
0
 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'
     )
Exemplo n.º 5
0
 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')
Exemplo n.º 6
0
 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'
     )
Exemplo n.º 7
0
 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')
Exemplo n.º 8
0
 def test_get_full_url_without_protocol_will_raise(self):
     m = Meta()
     with self.assertRaises(ImproperlyConfigured):
         m.get_full_url('foo/bar')
Exemplo n.º 9
0
 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'
     )
Exemplo n.º 10
0
 def test_get_full_url_with_None(self):
     m = Meta()
     self.assertEqual(m.get_full_url(None), None)
Exemplo n.º 11
0
 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')
Exemplo n.º 12
0
 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")
Exemplo n.º 13
0
 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")
Exemplo n.º 14
0
 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')