def test_switch_on__if_timeout_is_out_of_range__should_raise_error( self, timeout): sdk = Mock() obj = Relay(sdk, RelayGroup.lock, 2) with pytest.raises(ValueError): obj.switch_on(timeout)
def test_switch_on__should_call_sdk_method(self, group, number): sdk = Mock() obj = Relay(sdk, group, number) timeout = 45 obj.switch_on(timeout) sdk.control_device.assert_called_once_with( ControlOperation.output.value, number, group.value, timeout, 0)