本文整理汇总了Python中meta.views.MetadataMixin.image方法的典型用法代码示例。如果您正苦于以下问题:Python MetadataMixin.image方法的具体用法?Python MetadataMixin.image怎么用?Python MetadataMixin.image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meta.views.MetadataMixin
的用法示例。
在下文中一共展示了MetadataMixin.image方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_meta
# 需要导入模块: from meta.views import MetadataMixin [as 别名]
# 或者: from meta.views.MetadataMixin import image [as 别名]
def test_get_meta(self):
m = MetadataMixin()
m.title = 'title'
m.description = 'description'
m.keywords = ['foo', 'bar']
m.url = 'some/path'
m.image = 'images/foo.gif'
meta.settings.SITE_PROTOCOL = 'http'
meta.settings.SITE_DOMAIN = 'foo.com'
meta_object = m.get_meta()
self.assertTrue(type(meta_object), Meta)
self.assertEqual(
meta_object.title,
'title'
)
self.assertEqual(
meta_object.description,
'description'
)
self.assertEqual(
meta_object.url,
'http://foo.com/some/path'
)
self.assertEqual(
meta_object.keywords,
['foo', 'bar']
)
self.assertEqual(
meta_object.image,
'http://foo.com/static/images/foo.gif'
)
示例2: test_get_meta_image
# 需要导入模块: from meta.views import MetadataMixin [as 别名]
# 或者: from meta.views.MetadataMixin import image [as 别名]
def test_get_meta_image(self):
m = MetadataMixin()
self.assertEqual(
m.get_meta_image(),
None
)
m.image = 'img/foo.gif'
self.assertEqual(
m.get_meta_image(),
'img/foo.gif'
)
示例3: test_get_meta
# 需要导入模块: from meta.views import MetadataMixin [as 别名]
# 或者: from meta.views.MetadataMixin import image [as 别名]
def test_get_meta(self):
settings.SITE_PROTOCOL = 'http'
settings.SITE_DOMAIN = 'foo.com'
settings.USE_SITES = False
settings.FB_PAGES = 'fbpages'
settings.FB_APPID = 'appid'
m = MetadataMixin()
m.title = 'title'
m.description = 'description'
m.keywords = ['foo', 'bar']
m.url = 'some/path'
m.image = 'images/foo.gif'
meta_object = m.get_meta()
self.assertTrue(type(meta_object), Meta)
self.assertEqual(
meta_object.title,
'title'
)
self.assertEqual(
meta_object.description,
'description'
)
self.assertEqual(
meta_object.url,
'http://foo.com/some/path'
)
self.assertEqual(
meta_object.keywords,
['foo', 'bar']
)
self.assertEqual(
meta_object.image,
'http://foo.com/static/images/foo.gif'
)
settings.SITE_DOMAIN = 'example.com'