本文整理汇总了Python中waffle.models.Switch.get_switches_for_site方法的典型用法代码示例。如果您正苦于以下问题:Python Switch.get_switches_for_site方法的具体用法?Python Switch.get_switches_for_site怎么用?Python Switch.get_switches_for_site使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waffle.models.Switch
的用法示例。
在下文中一共展示了Switch.get_switches_for_site方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_switches_for_site
# 需要导入模块: from waffle.models import Switch [as 别名]
# 或者: from waffle.models.Switch import get_switches_for_site [as 别名]
def test_get_switches_for_site(self):
self.assertTrue(len(Switch.get_switches_for_site(self.site1)) == 0)
name1 = "foo"
Switch.objects.create(name=name1, active=True, site=self.site1)
self.assertEqual([name1], [sw.name for sw in Switch.get_switches_for_site(self.site1)])
# by default switch is sites-global
self.assertEqual([name1], [sw.name for sw in Switch.get_switches_for_site(self.site2)])
name2 = "bar"
Switch.objects.create(name=name2, active=True, site=self.site2, all_sites_override=False)
self.assertEqual({name1, name2}, set([sw.name for sw in Switch.get_switches_for_site(self.site2)]))
self.assertEqual([name1], [sw.name for sw in Switch.get_switches_for_site(self.site1)])