本文整理汇总了Python中djblets.avatars.registry.AvatarServiceRegistry.enabled_services方法的典型用法代码示例。如果您正苦于以下问题:Python AvatarServiceRegistry.enabled_services方法的具体用法?Python AvatarServiceRegistry.enabled_services怎么用?Python AvatarServiceRegistry.enabled_services使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类djblets.avatars.registry.AvatarServiceRegistry
的用法示例。
在下文中一共展示了AvatarServiceRegistry.enabled_services方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_disable_default_from_setter
# 需要导入模块: from djblets.avatars.registry import AvatarServiceRegistry [as 别名]
# 或者: from djblets.avatars.registry.AvatarServiceRegistry import enabled_services [as 别名]
def test_disable_default_from_setter(self):
"""Testing AvatarServiceRegistry.enabled_services setter unsets the
default services
"""
registry = AvatarServiceRegistry()
registry.enable_service(GravatarService.id)
registry.set_default_service(registry.get('id', GravatarService.id))
registry.enabled_services = []
self.assertIsNone(registry.default_service)
示例2: test_set_enabled_services
# 需要导入模块: from djblets.avatars.registry import AvatarServiceRegistry [as 别名]
# 或者: from djblets.avatars.registry.AvatarServiceRegistry import enabled_services [as 别名]
def test_set_enabled_services(self):
"""Testing AvatarServiceRegistry.enabled_services setter"""
registry = AvatarServiceRegistry()
dummy_service = DummyAvatarService()
registry.register(dummy_service)
gravatar_service = registry.get('id', GravatarService.id)
registry.enabled_services = [dummy_service, gravatar_service]
self.assertEqual(registry.enabled_services,
{dummy_service, gravatar_service})
示例3: test_set_enabled_services_invalid_service
# 需要导入模块: from djblets.avatars.registry import AvatarServiceRegistry [as 别名]
# 或者: from djblets.avatars.registry.AvatarServiceRegistry import enabled_services [as 别名]
def test_set_enabled_services_invalid_service(self):
"""Testing AvatarServiceRegistry.enabled_services setter with an
unregistered service
"""
registry = AvatarServiceRegistry()
dummy_service = DummyAvatarService()
gravatar_service = registry.get('avatar_service_id',
GravatarService.avatar_service_id)
with self.assertRaises(ItemLookupError):
registry.enabled_services = [dummy_service, gravatar_service]
self.assertEqual(registry.enabled_services, set())
示例4: test_default_service
# 需要导入模块: from djblets.avatars.registry import AvatarServiceRegistry [as 别名]
# 或者: from djblets.avatars.registry.AvatarServiceRegistry import enabled_services [as 别名]
def test_default_service(self):
"""Testing AvatarServiceRegistry.default_service"""
registry = AvatarServiceRegistry()
dummy_serivce = DummyAvatarService()
gravatar_service = registry.get('id', GravatarService.id)
registry.register(dummy_serivce)
registry.enabled_services = [dummy_serivce, gravatar_service]
self.assertIsNone(registry.default_service)
registry.set_default_service(dummy_serivce)
self.assertEqual(registry.default_service, dummy_serivce)
registry.set_default_service(gravatar_service)
self.assertEqual(registry.default_service, gravatar_service)
registry.set_default_service(None)
self.assertIsNone(registry.default_service)