当前位置: 首页>>代码示例>>Python>>正文


Python AvatarServiceRegistry.disable_service方法代码示例

本文整理汇总了Python中djblets.avatars.registry.AvatarServiceRegistry.disable_service方法的典型用法代码示例。如果您正苦于以下问题:Python AvatarServiceRegistry.disable_service方法的具体用法?Python AvatarServiceRegistry.disable_service怎么用?Python AvatarServiceRegistry.disable_service使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在djblets.avatars.registry.AvatarServiceRegistry的用法示例。


在下文中一共展示了AvatarServiceRegistry.disable_service方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_disable_default

# 需要导入模块: from djblets.avatars.registry import AvatarServiceRegistry [as 别名]
# 或者: from djblets.avatars.registry.AvatarServiceRegistry import disable_service [as 别名]
    def test_disable_default(self):
        """Testing AvatarServiceRegistry.disable_service unsets the default
        service
        """
        registry = AvatarServiceRegistry()
        registry.enable_service(GravatarService.id)
        registry.set_default_service(registry.get('id', GravatarService.id))

        registry.disable_service(GravatarService.id)
        self.assertIsNone(registry.default_service)
开发者ID:iconoeugen,项目名称:djblets,代码行数:12,代码来源:tests.py

示例2: test_disable_service

# 需要导入模块: from djblets.avatars.registry import AvatarServiceRegistry [as 别名]
# 或者: from djblets.avatars.registry.AvatarServiceRegistry import disable_service [as 别名]
    def test_disable_service(self):
        """Testing AvatarServiceRegistry.disable_service"""
        registry = AvatarServiceRegistry()
        self.assertFalse(registry.is_enabled(GravatarService.id))
        registry.enable_service(GravatarService.id)

        self.assertTrue(registry.is_enabled(GravatarService.id))
        self.assertSetEqual(set(registry.enabled_services),
                            set(registry))

        registry.disable_service(GravatarService.id)
        self.assertFalse(registry.is_enabled(GravatarService.id))
        self.assertSetEqual(set(registry.enabled_services), set())
开发者ID:iconoeugen,项目名称:djblets,代码行数:15,代码来源:tests.py

示例3: test_disable_default

# 需要导入模块: from djblets.avatars.registry import AvatarServiceRegistry [as 别名]
# 或者: from djblets.avatars.registry.AvatarServiceRegistry import disable_service [as 别名]
    def test_disable_default(self):
        """Testing AvatarServiceRegistry.disable_service unsets the default
        service
        """
        registry = AvatarServiceRegistry()
        registry.enable_service(GravatarService)
        registry.set_default_service(GravatarService)

        registry.disable_service(GravatarService)
        self.assertIsNone(registry.default_service)

        siteconfig = SiteConfiguration.objects.get_current()
        self.assertEqual(
            siteconfig.get(AvatarServiceRegistry.ENABLED_SERVICES_KEY),
            [])
        self.assertIsNone(
            siteconfig.get(AvatarServiceRegistry.DEFAULT_SERVICE_KEY))
开发者ID:chipx86,项目名称:djblets,代码行数:19,代码来源:tests.py

示例4: test_disable_service

# 需要导入模块: from djblets.avatars.registry import AvatarServiceRegistry [as 别名]
# 或者: from djblets.avatars.registry.AvatarServiceRegistry import disable_service [as 别名]
    def test_disable_service(self):
        """Testing AvatarServiceRegistry.disable_service"""
        registry = AvatarServiceRegistry()
        self.assertFalse(registry.is_enabled(GravatarService))
        registry.enable_service(GravatarService)

        self.assertTrue(registry.is_enabled(GravatarService))
        self.assertEqual(set(registry.enabled_services), {GravatarService})

        registry.disable_service(GravatarService)
        self.assertFalse(registry.is_enabled(GravatarService))
        self.assertEqual(set(registry.enabled_services), set())

        siteconfig = SiteConfiguration.objects.get_current()
        self.assertEqual(
            siteconfig.get(AvatarServiceRegistry.ENABLED_SERVICES_KEY),
            [])
开发者ID:chipx86,项目名称:djblets,代码行数:19,代码来源:tests.py

示例5: test_disable_service_with_save_false

# 需要导入模块: from djblets.avatars.registry import AvatarServiceRegistry [as 别名]
# 或者: from djblets.avatars.registry.AvatarServiceRegistry import disable_service [as 别名]
    def test_disable_service_with_save_false(self):
        """Testing AvatarServiceRegistry.disable_service with save=False"""
        registry = AvatarServiceRegistry()
        self.assertFalse(registry.is_enabled(GravatarService))
        registry.enable_service(GravatarService)

        self.assertTrue(registry.is_enabled(GravatarService))
        self.assertEqual(set(registry.enabled_services), {GravatarService})

        registry.disable_service(GravatarService, save=False)
        self.assertFalse(registry.is_enabled(GravatarService))
        self.assertEqual(set(registry.enabled_services), set())

        # Make sure we've saved this in our cached siteconfig...
        siteconfig = SiteConfiguration.objects.get_current()
        self.assertEqual(
            siteconfig.get(AvatarServiceRegistry.ENABLED_SERVICES_KEY),
            [])

        # ... but not in the database.
        siteconfig = SiteConfiguration.objects.get(pk=siteconfig.pk)
        self.assertEqual(
            siteconfig.get(AvatarServiceRegistry.ENABLED_SERVICES_KEY),
            [GravatarService.avatar_service_id])
开发者ID:chipx86,项目名称:djblets,代码行数:26,代码来源:tests.py


注:本文中的djblets.avatars.registry.AvatarServiceRegistry.disable_service方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。