예제 #1
0
def test__get_devices_exception(mock__http_request):
    mock__http_request.side_effect = [ConnectionError]
    test_ksh = KodakSmartHome("fake_user", "fake_pass")
    test_ksh.is_connected = True

    with pytest.raises(ConnectionError):
        test_ksh._get_devices()
예제 #2
0
def test__get_devices(mock__http_request):

    mock__http_request.return_value = devices_response
    test_ksh = KodakSmartHome("fake_user", "fake_pass")
    test_ksh.is_connected = True

    test_devices = test_ksh._get_devices()

    assert test_devices == devices_response["data"]
예제 #3
0
def test__get_devices_is_connected_false(mock__http_request, mock_connect):

    mock__http_request.return_value = [devices_response, devices_response]
    mock_connect.return_value = devices_response
    test_ksh = KodakSmartHome("fake_user", "fake_pass")
    test_ksh.is_connected = False

    test_devices = test_ksh._get_devices()

    assert test_devices == []