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]
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]
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)'
def test_find_by_name_None(): datasource = TheTvDb() result = datasource.find_by_name(None) assert 0 == len(result)
def test_find_by_name_empty(): datasource = TheTvDb() result = datasource.find_by_name('') assert 0 == len(result)