Beispiel #1
0
def test_omdb_title__media_type__movie(omdb_api_key):
    expected_top_level_keys = {
        "Actors",
        "Awards",
        "BoxOffice",
        "Country",
        "Director",
        "DVD",
        "Genre",
        "imdbID",
        "imdbRating",
        "imdbVotes",
        "Language",
        "Metascore",
        "Plot",
        "Poster",
        "Production",
        "Rated",
        "Ratings",
        "Released",
        "Response",
        "Runtime",
        "Title",
        "Type",
        "Website",
        "Writer",
        "Year",
    }
    result = omdb_title(omdb_api_key,
                        media_type="movie",
                        title="ninja turtles")
    assert expected_top_level_keys == set(result.keys())
    assert result["Response"]
    assert result["Type"] == "movie"
    assert result["Title"] == "Teenage Mutant Ninja Turtles"
Beispiel #2
0
def test_omdb_title__media_type__series(omdb_api_key):
    expected_top_level_keys = {
        "Actors",
        "Awards",
        "Country",
        "Director",
        "Genre",
        "imdbID",
        "imdbRating",
        "imdbVotes",
        "Language",
        "Metascore",
        "Plot",
        "Poster",
        "Rated",
        "Ratings",
        "Released",
        "Response",
        "Runtime",
        "Title",
        "totalSeasons",
        "Type",
        "Writer",
        "Year",
    }

    result = omdb_title(omdb_api_key,
                        media_type="series",
                        title="ninja turtles")
    assert set(result.keys()) == expected_top_level_keys
    assert result["Response"]
    assert result["Type"] == "series"
    assert result["Title"] == "Teenage Mutant Ninja Turtles"
Beispiel #3
0
def test_omdb_title__title_id_xnor__both(mock_request, omdb_api_key):
    mock_response = MockRequestResponse(200, '{"key":"value"}')
    mock_request.return_value = mock_response
    with pytest.raises(MapiProviderException):
        omdb_title(omdb_api_key, title="some title", id_imdb=123)
Beispiel #4
0
def test_omdb_title__title_id_xnor__neither(mock_request, omdb_api_key):
    mock_response = MockRequestResponse(200, '{"key":"value"}')
    mock_request.return_value = mock_response
    with pytest.raises(MapiProviderException):
        omdb_title(omdb_api_key)
Beispiel #5
0
def test_omdb_title__title_id_xnor__id(mock_request, omdb_api_key):
    mock_response = MockRequestResponse(200, '{"key":"value"}')
    mock_request.return_value = mock_response
    omdb_title(omdb_api_key, id_imdb=123)
Beispiel #6
0
def test_omdb_title__not_found(omdb_api_key):
    with pytest.raises(MapiNotFoundException):
        omdb_title(omdb_api_key, "1" * 2)
Beispiel #7
0
def test_omdb_title__id_imdb_fail(omdb_api_key):
    with pytest.raises(MapiProviderException):
        omdb_title(omdb_api_key, "")
Beispiel #8
0
def test_omdb_title__api_key_fail():
    with pytest.raises(MapiProviderException):
        omdb_title(JUNK_TEXT, "", cache=False)
Beispiel #9
0
def test_omdb_title__media_type__junk(omdb_api_key):
    with pytest.raises(MapiProviderException):
        omdb_title(omdb_api_key, media_type="yolo", title="ninja turtles")