|
@@ -8,16 +8,18 @@ import intertechno_cc1101._cli
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
|
- ("argv", "address", "button_index", "turn_on"),
|
|
|
+ ("argv", "address", "button_index", "turn_on", "power_setting"),
|
|
|
(
|
|
|
- (["-a", "12345678", "-1"], 12345678, 0, True),
|
|
|
- (["-a", "12345678", "-0"], 12345678, 0, False),
|
|
|
- (["--address", "12345678", "--turn-on"], 12345678, 0, True),
|
|
|
- (["-a", "12345678", "--turn-off"], 12345678, 0, False),
|
|
|
- (["-a", "12345678", "-b", "7", "-1"], 12345678, 7, True),
|
|
|
+ (["-a", "12345678", "-1"], 12345678, 0, True, 0xC6),
|
|
|
+ (["-a", "12345678", "-0"], 12345678, 0, False, 0xC6),
|
|
|
+ (["--address", "12345678", "--turn-on"], 12345678, 0, True, 0xC6),
|
|
|
+ (["-a", "12345678", "--turn-off"], 12345678, 0, False, 0xC6),
|
|
|
+ (["-a", "12345678", "-b", "7", "-1"], 12345678, 7, True, 0xC6),
|
|
|
+ (["-a", "12345678", "-1", "-p", str(0xC0)], 12345678, 0, True, 0xC0),
|
|
|
+ (["-a", "12345678", "-0", "--power-setting", "14"], 12345678, 0, False, 14),
|
|
|
),
|
|
|
)
|
|
|
-def test__main(argv, address, button_index, turn_on):
|
|
|
+def test__main(argv, address, button_index, turn_on, power_setting):
|
|
|
with unittest.mock.patch(
|
|
|
"intertechno_cc1101.RemoteControl"
|
|
|
) as remote_control_class_mock, unittest.mock.patch("sys.argv", [""] + argv):
|
|
@@ -25,11 +27,11 @@ def test__main(argv, address, button_index, turn_on):
|
|
|
remote_control_class_mock.assert_called_once_with(address=address)
|
|
|
if turn_on:
|
|
|
remote_control_class_mock().turn_on.assert_called_once_with(
|
|
|
- button_index=button_index
|
|
|
+ button_index=button_index, output_power_setting=power_setting
|
|
|
)
|
|
|
remote_control_class_mock().turn_off.assert_not_called()
|
|
|
else:
|
|
|
remote_control_class_mock().turn_off.assert_called_once_with(
|
|
|
- button_index=button_index
|
|
|
+ button_index=button_index, output_power_setting=power_setting
|
|
|
)
|
|
|
remote_control_class_mock().turn_on.assert_not_called()
|