def test_search__missing(provider: Omdb): query = MetadataMovie() with pytest.raises(MnamerNotFoundException): next(provider.search(query))
def test_search__no_hits(provider: Omdb): query = MetadataMovie(name=JUNK_TEXT) with pytest.raises(MnamerNotFoundException): next(provider.search(query))
def test_search__name(meta, provider: Omdb): provider = Omdb() query = MetadataMovie(name=meta["name"]) assert any(result.id_imdb == meta["id_imdb"] for result in provider.search(query))
def test_search__name__year(meta, provider: Omdb): provider = Omdb() query = MetadataMovie(name=meta["name"], year=meta["year"]) for result in provider.search(query): assert (result.year - int(meta["year"])) <= 2
def test_search__id(meta: Dict[str, str], provider: Omdb): query = MetadataMovie(id_imdb=meta["id_imdb"]) results = list(provider.search(query)) assert len(results) == 1 result = results[0] assert result.name == meta["name"]