def test_shell_error(self): mock_adb = Mock() mock_adb.shell_command.return_value = "error" Adb.adb = mock_adb with pytest.raises(Adb.AdbError): Adb.shell(123, "test_command") expected_calls = [ call.set_target_by_name(123), call.shell_command('test_command') ] assert mock_adb.mock_calls == expected_calls
def test_shell_succes(self): mock_adb = Mock() mock_adb.shell_command.return_value = "succes " Adb.adb = mock_adb result = Adb.shell(123, "test_command") expected_calls = [ call.set_target_by_name(123), call.shell_command('test_command') ] assert mock_adb.mock_calls == expected_calls assert result == 'succes'