本文整理汇总了Python中meta.views.MetadataMixin类的典型用法代码示例。如果您正苦于以下问题:Python MetadataMixin类的具体用法?Python MetadataMixin怎么用?Python MetadataMixin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MetadataMixin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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'
)
开发者ID:intip,项目名称:django-meta,代码行数:9,代码来源:test_metadata_mixin.py
示例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'
)
开发者ID:intip,项目名称:django-meta,代码行数:9,代码来源:test_metadata_mixin.py
示例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'
)
开发者ID:intip,项目名称:django-meta,代码行数:12,代码来源:test_metadata_mixin.py
示例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'
)
开发者ID:intip,项目名称:django-meta,代码行数:12,代码来源:test_metadata_mixin.py
示例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'
)
开发者ID:intip,项目名称:django-meta,代码行数:12,代码来源:test_metadata_mixin.py
示例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'
)
开发者ID:intip,项目名称:django-meta,代码行数:12,代码来源:test_metadata_mixin.py
示例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'
)
开发者ID:intip,项目名称:django-meta,代码行数:12,代码来源:test_metadata_mixin.py
示例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'
)
开发者ID:intip,项目名称:django-meta,代码行数:12,代码来源:test_metadata_mixin.py
示例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'
)
开发者ID:intip,项目名称:django-meta,代码行数:12,代码来源:test_metadata_mixin.py
示例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'
)
开发者ID:intip,项目名称:django-meta,代码行数:12,代码来源:test_metadata_mixin.py
示例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'
)
开发者ID:intip,项目名称:django-meta,代码行数:12,代码来源:test_metadata_mixin.py
示例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'
)
开发者ID:intip,项目名称:django-meta,代码行数:12,代码来源:test_metadata_mixin.py
示例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'
)
开发者ID:intip,项目名称:django-meta,代码行数:12,代码来源:test_metadata_mixin.py
示例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'
)
开发者ID:intip,项目名称:django-meta,代码行数:13,代码来源:test_metadata_mixin.py
示例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'
)
开发者ID:intip,项目名称:django-meta,代码行数:34,代码来源:test_metadata_mixin.py
示例16: test_get_meta_extra_props
def test_get_meta_extra_props(self):
m = MetadataMixin()
self.assertEqual(
m.get_meta_extra_props(),
None
)
m.extra_props = {
'app_name': 'Foo',
'app_id': 'Bar'
}
self.assertEqual(
m.get_meta_extra_props(),
{
'app_name': 'Foo',
'app_id': 'Bar'
}
)
开发者ID:intip,项目名称:django-meta,代码行数:18,代码来源:test_metadata_mixin.py
示例17: test_get_meta_extra_custom_props
def test_get_meta_extra_custom_props(self):
m = MetadataMixin()
self.assertEqual(
m.get_meta_extra_custom_props(),
None
)
m.extra_custom_props = [
('property', 'app_name', 'Foo'),
('property', 'app_id', 'Bar'),
]
self.assertEqual(
m.get_meta_extra_custom_props(),
[
('property', 'app_name', 'Foo'),
('property', 'app_id', 'Bar'),
]
)
开发者ID:intip,项目名称:django-meta,代码行数:18,代码来源:test_metadata_mixin.py
示例18: test_get_meta
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'
开发者ID:nephila,项目名称:django-meta,代码行数:38,代码来源:test_metadata_mixin.py
示例19: 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'
)
settings.OG_NAMESPACES = ['foo', 'bar']
m = MetadataMixin()
self.assertEqual(
m.get_meta_custom_namespace(),
['foo', 'bar']
)
settings.OG_NAMESPACES = None
开发者ID:nephila,项目名称:django-meta,代码行数:20,代码来源:test_metadata_mixin.py
示例20: test_get_meta_class
def test_get_meta_class(self):
m = MetadataMixin()
self.assertEqual(
m.get_meta_class(),
Meta
)
开发者ID:intip,项目名称:django-meta,代码行数:6,代码来源:test_metadata_mixin.py
注:本文中的meta.views.MetadataMixin类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论