本文整理汇总了Python中gutter.client.models.Switch.enabled_for方法的典型用法代码示例。如果您正苦于以下问题:Python Switch.enabled_for方法的具体用法?Python Switch.enabled_for怎么用?Python Switch.enabled_for使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gutter.client.models.Switch
的用法示例。
在下文中一共展示了Switch.enabled_for方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_and_register_switch
# 需要导入模块: from gutter.client.models import Switch [as 别名]
# 或者: from gutter.client.models.Switch import enabled_for [as 别名]
def build_and_register_switch(self, name, enabled_for=False):
switch = Switch(name)
switch.enabled_for = mock.Mock(return_value=enabled_for)
self.manager.register(switch)
return switch
示例2: test_switch_enabed_for_skips_switch_active_signal_when_not_enabled
# 需要导入模块: from gutter.client.models import Switch [as 别名]
# 或者: from gutter.client.models.Switch import enabled_for [as 别名]
def test_switch_enabed_for_skips_switch_active_signal_when_not_enabled(self, signal):
switch = Switch("foo", state=Switch.states.DISABLED)
eq_(switch.enabled_for("causing input"), False)
eq_(signal.call.called, False)
示例3: test_switch_enabed_for_calls_switch_active_signal_when_enabled
# 需要导入模块: from gutter.client.models import Switch [as 别名]
# 或者: from gutter.client.models.Switch import enabled_for [as 别名]
def test_switch_enabed_for_calls_switch_active_signal_when_enabled(self, signal):
switch = Switch("foo", state=Switch.states.GLOBAL)
ok_(switch.enabled_for("causing input"))
signal.call.assert_called_once_with(switch, "causing input")
示例4: test_switch_enabed_for_calls_switch_checked_signal
# 需要导入模块: from gutter.client.models import Switch [as 别名]
# 或者: from gutter.client.models.Switch import enabled_for [as 别名]
def test_switch_enabed_for_calls_switch_checked_signal(self, signal):
switch = Switch("foo")
switch.enabled_for(True)
signal.call.assert_called_once_with(switch)
示例5: test_switch_enabed_for_skips_switch_active_signal_when_not_enabled
# 需要导入模块: from gutter.client.models import Switch [as 别名]
# 或者: from gutter.client.models.Switch import enabled_for [as 别名]
def test_switch_enabed_for_skips_switch_active_signal_when_not_enabled(self, signal):
switch = Switch('foo', manager='manager', state=Switch.states.DISABLED)
eq_(switch.enabled_for('causing input'), False)
eq_(signal.call.called, False)
示例6: test_switch_enabed_for_calls_switch_active_signal_when_enabled
# 需要导入模块: from gutter.client.models import Switch [as 别名]
# 或者: from gutter.client.models.Switch import enabled_for [as 别名]
def test_switch_enabed_for_calls_switch_active_signal_when_enabled(self, signal):
switch = Switch('foo', manager='manager', state=Switch.states.GLOBAL)
ok_(switch.enabled_for('causing input'))
signal.call.assert_called_once_with(switch, 'causing input')