本文整理汇总了Python中feature.Feature.disable方法的典型用法代码示例。如果您正苦于以下问题:Python Feature.disable方法的具体用法?Python Feature.disable怎么用?Python Feature.disable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类feature.Feature
的用法示例。
在下文中一共展示了Feature.disable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestFeatureAPI
# 需要导入模块: from feature import Feature [as 别名]
# 或者: from feature.Feature import disable [as 别名]
class TestFeatureAPI(TestCase):
def setUp(self):
self.feature = Feature("test_feature")
def test_features_disabled_by_default(self):
self.assertFalse(self.feature.is_enabled(fake_request()))
def test_can_enable_features(self):
request = fake_request()
self.feature.enable(request)
self.assertTrue(self.feature.is_enabled(request))
def test_can_disable_features(self):
request = fake_request()
self.feature.enable(request)
self.feature.disable(request)
self.assertFalse(self.feature.is_enabled(request))
def test_can_enable_two_features(self):
feature2 = Feature("second_test_feature")
request = fake_request()
self.feature.enable(request)
feature2.enable(request)
self.assertTrue(self.feature.is_enabled(request))
self.assertTrue(feature2.is_enabled(request))
示例2: set_enabled
# 需要导入模块: from feature import Feature [as 别名]
# 或者: from feature.Feature import disable [as 别名]
def set_enabled(request):
f = Feature(request.POST['name'])
enabled = request.POST['enabled'] == 'True'
if enabled:
f.enable(request)
else:
f.disable(request)
return redirect("/feature/")