def test_connect_succes(self): mock_adb = Mock() mock_adb.get_devices.return_value = {'a': 12, 'b': 13, 'c': 123} Adb.adb = mock_adb Adb.connect(123) mock_adb.get_devices.assert_called_once()
def test_connect_device_missing(self): mock_adb = Mock() mock_adb.get_devices.return_value = {'a': 12, 'b': 13} Adb.adb = mock_adb with pytest.raises(Adb.ConnectionError): Adb.connect(123) mock_adb.get_devices.assert_called_once()
def test_connect_no_devices(self): mock_adb = Mock() mock_adb.get_devices.return_value = {} Adb.adb = mock_adb with pytest.raises(Adb.ConnectionError): Adb.connect('123') mock_adb.get_devices.assert_called_once()