Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_mode(runner, mock_rak811):
p = PropertyMock(return_value=Mode.LoRaWan)
type(mock_rak811.return_value).mode = p
result = runner.invoke(cli, ['mode'])
p.assert_called_once_with()
assert result.output == 'LoRaWan\n'
def test_set_mode(mock_send, lora):
"""Test mode setter."""
lora.mode = Mode.LoRaWan
mock_send.assert_called_once_with('mode=0')
def test_mode_lora(runner, mock_rak811):
p = PropertyMock()
type(mock_rak811.return_value).mode = p
result = runner.invoke(cli, ['-v', 'mode', 'LoRawan'])
p.assert_called_once_with(Mode.LoRaWan)
assert result.output == 'Mode set to LoRaWan.\n'