本文整理汇总了Python中meta.views.MetadataMixin类的典型用法代码示例。如果您正苦于以下问题:Python MetadataMixin类的具体用法?Python MetadataMixin怎么用?Python MetadataMixin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MetadataMixin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_meta_object_type_with_setting
def test_get_meta_object_type_with_setting(self):
m = MetadataMixin()
meta.settings.SITE_TYPE = 'foo'
self.assertEqual(
m.get_meta_object_type(),
'foo'
)
示例2: test_get_meta_site_name_with_setting
def test_get_meta_site_name_with_setting(self):
m = MetadataMixin()
meta.settings.SITE_NAME = 'Foo'
self.assertEqual(
m.get_meta_site_name(),
'Foo'
)
示例3: test_get_meta_twitter_card
def test_get_meta_twitter_card(self):
m = MetadataMixin()
self.assertEqual(
m.get_meta_twitter_card(),
None
)
m.twitter_card = 'summary'
self.assertEqual(
m.get_meta_twitter_card(),
'summary'
)
示例4: test_get_meta_site_name
def test_get_meta_site_name(self):
m = MetadataMixin()
self.assertEqual(
m.get_meta_site_name(),
None
)
m.site_name = 'Foo'
self.assertEqual(
m.get_meta_site_name(),
'Foo'
)
示例5: test_get_meta_object_tye
def test_get_meta_object_tye(self):
m = MetadataMixin()
self.assertEqual(
m.get_meta_object_type(),
None
)
m.object_type = 'bar'
self.assertEqual(
m.get_meta_object_type(),
'bar'
)
示例6: test_get_meta_url
def test_get_meta_url(self):
m = MetadataMixin()
self.assertEqual(
m.get_meta_url(),
None
)
m.url = '/foo/bar'
self.assertEqual(
m.get_meta_url(),
'/foo/bar'
)
示例7: test_get_meta_facebook_app_id
def test_get_meta_facebook_app_id(self):
m = MetadataMixin()
self.assertEqual(
m.get_meta_facebook_app_id(),
None
)
m.facebook_app_id = '12345'
self.assertEqual(
m.get_meta_facebook_app_id(),
'12345'
)
示例8: test_get_meta_description
def test_get_meta_description(self):
m = MetadataMixin()
self.assertEqual(
m.get_meta_description(),
None
)
m.description = 'Foo'
self.assertEqual(
m.get_meta_description(),
'Foo'
)
示例9: test_get_meta_locale
def test_get_meta_locale(self):
m = MetadataMixin()
self.assertEqual(
m.get_meta_locale(),
None
)
m.locale = 'en_US'
self.assertEqual(
m.get_meta_locale(),
'en_US'
)
示例10: test_get_meta_title
def test_get_meta_title(self):
m = MetadataMixin()
self.assertEqual(
m.get_meta_title(),
None
)
m.title = 'Foo'
self.assertEqual(
m.get_meta_title(),
'Foo'
)
示例11: test_get_meta_twitter_creator
def test_get_meta_twitter_creator(self):
m = MetadataMixin()
self.assertEqual(
m.get_meta_twitter_creator(),
None
)
m.twitter_creator = '@foo'
self.assertEqual(
m.get_meta_twitter_creator(),
'@foo'
)
示例12: test_get_meta_twitter_site
def test_get_meta_twitter_site(self):
m = MetadataMixin()
self.assertEqual(
m.get_meta_twitter_site(),
None
)
m.twitter_site = '@foo'
self.assertEqual(
m.get_meta_twitter_site(),
'@foo'
)
示例13: test_get_meta_custom_namespace
def test_get_meta_custom_namespace(self):
m = MetadataMixin()
self.assertEqual(
m.get_meta_custom_namespace(),
None
)
m.custom_namespace = "my-website"
self.assertEqual(
m.get_meta_custom_namespace(),
'my-website'
)
示例14: test_get_meta_image
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'
)
示例15: test_get_meta
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'
)