コード例 #1
0
def test_find_by_name_multi_match():
    datasource = TheTvDb()
    result = datasource.find_by_name('Family')
    assert 5 < len(result)

    assert 'Family' == result[0][0]
    assert 'tt0073992' == result[0][1]
コード例 #2
0
def test_find_by_name_single_match():
    datasource = TheTvDb()
    result = datasource.find_by_name('Brooklyn Nine-Nine')
    assert 1 == len(result)

    assert 'Brooklyn Nine-Nine' == result[0][0]
    assert 'tt2467372' == result[0][1]
コード例 #3
0
def test_find_by_name_server_error():
    # Prepare a fake server error response
    responses.add(responses.GET, 'http://thetvdb.com/api/GetSeries.php',
                  status=404)
    datasource = TheTvDb()

    # Ensure an exception is thrown
    with pytest.raises(DataSourceException) as exceptionInfo:
        result = datasource.find_by_name('Breaking')

    # Assert exception message
    assert str(exceptionInfo.value) == 'Failed search by name (server error)'
コード例 #4
0
def test_find_by_name_None():
    datasource = TheTvDb()
    result = datasource.find_by_name(None)
    assert 0 == len(result)
コード例 #5
0
def test_find_by_name_empty():
    datasource = TheTvDb()
    result = datasource.find_by_name('')
    assert 0 == len(result)