本文整理汇总了Python中meta.views.Meta.get_full_url方法的典型用法代码示例。如果您正苦于以下问题:Python Meta.get_full_url方法的具体用法?Python Meta.get_full_url怎么用?Python Meta.get_full_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meta.views.Meta
的用法示例。
在下文中一共展示了Meta.get_full_url方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_full_url_without_schema
# 需要导入模块: from meta.views import Meta [as 别名]
# 或者: from meta.views.Meta import get_full_url [as 别名]
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'
)
示例2: test_get_full_url_with_absolute_path
# 需要导入模块: from meta.views import Meta [as 别名]
# 或者: from meta.views.Meta import get_full_url [as 别名]
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'
)
示例3: test_get_full_url_with_domain_and_protocol
# 需要导入模块: from meta.views import Meta [as 别名]
# 或者: from meta.views.Meta import get_full_url [as 别名]
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'
)
示例4: test_get_full_url_without_site_id_with_request_will_not_raise
# 需要导入模块: from meta.views import Meta [as 别名]
# 或者: from meta.views.Meta import get_full_url [as 别名]
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'
)
示例5: test_get_full_url_without_domain_will_raise
# 需要导入模块: from meta.views import Meta [as 别名]
# 或者: from meta.views.Meta import get_full_url [as 别名]
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')
示例6: test_get_full_url_without_protocol_will_raise
# 需要导入模块: from meta.views import Meta [as 别名]
# 或者: from meta.views.Meta import get_full_url [as 别名]
def test_get_full_url_without_protocol_will_raise(self):
m = Meta()
with self.assertRaises(ImproperlyConfigured):
m.get_full_url('foo/bar')
示例7: test_get_full_url_with_full_url
# 需要导入模块: from meta.views import Meta [as 别名]
# 或者: from meta.views.Meta import get_full_url [as 别名]
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'
)
示例8: test_get_full_url_with_None
# 需要导入模块: from meta.views import Meta [as 别名]
# 或者: from meta.views.Meta import get_full_url [as 别名]
def test_get_full_url_with_None(self):
m = Meta()
self.assertEqual(m.get_full_url(None), None)
示例9: test_get_full_url_with_absolute_path
# 需要导入模块: from meta.views import Meta [as 别名]
# 或者: from meta.views.Meta import get_full_url [as 别名]
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")
示例10: test_get_full_url_with_domain_and_protocol
# 需要导入模块: from meta.views import Meta [as 别名]
# 或者: from meta.views.Meta import get_full_url [as 别名]
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")
示例11: test_get_full_url_without_site_id_will_raise
# 需要导入模块: from meta.views import Meta [as 别名]
# 或者: from meta.views.Meta import get_full_url [as 别名]
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')