test: delete slow, timing-based and redundant tests

This commit is contained in:
imSp4rky
2026-12-05 15:20:05 -07:00
parent 783a2fc185
commit 3a0a74e694
292 changed files with 153 additions and 15174 deletions
-30
View File
@@ -62,17 +62,6 @@ def _provider(monkeypatch: pytest.MonkeyPatch, responses: list[dict]) -> tuple[I
NOT_FOUND = {"errors": [{"message": "PersistedQueryNotFound", "extensions": {"code": "PERSISTED_QUERY_NOT_FOUND"}}]}
def test_is_available_without_any_key() -> None:
assert IMDBProvider().is_available() is True
def test_cache_hit_uses_one_get(monkeypatch: pytest.MonkeyPatch) -> None:
p, session = _provider(monkeypatch, [{"data": {"title": node()}}])
result = p.get_by_id("tt3581920", "tv")
assert result is not None and result.title == "The Last of Us"
assert len(session.gets) == 1 and session.posts == []
def test_persisted_query_miss_falls_back_to_one_post(monkeypatch: pytest.MonkeyPatch) -> None:
p, session = _provider(monkeypatch, [NOT_FOUND, {"data": {"title": node()}}])
result = p.get_by_id("tt3581920", "tv")
@@ -128,15 +117,6 @@ def test_search_uses_its_own_operation_and_one_get_on_a_cache_hit(monkeypatch: p
assert session.posts == []
def test_search_query_text_carries_the_constraints(monkeypatch: pytest.MonkeyPatch) -> None:
p, session = _provider(monkeypatch, [NOT_FOUND, edges(node())])
p.search("The Last of Us", 2023, "tv")
query = session.posts[0]["query"]
assert 'searchTerm: "The Last of Us"' in query
assert 'start: "2023-01-01", end: "2023-12-31"' in query
assert '["tvSeries", "tvMiniSeries"]' in query or '["tvSeries","tvMiniSeries"]' in query
def test_search_omits_the_year_range_when_unknown(monkeypatch: pytest.MonkeyPatch) -> None:
p, session = _provider(monkeypatch, [NOT_FOUND, edges(node(title_type="movie"))])
p.search("Inception", None, "movie")
@@ -197,12 +177,6 @@ def test_a_trailing_number_that_is_not_the_year_stays_in_the_search_term(monkeyp
assert 'searchTerm: "EXAMPLE 2049"' in session.posts[0]["query"]
def test_a_hit_in_the_year_does_not_retry(monkeypatch: pytest.MonkeyPatch) -> None:
p, session = _provider(monkeypatch, [edges(node())])
assert p.search("The Last of Us", 2023, "tv") is not None
assert len(session.gets) == 1
def test_search_term_drops_a_year_suffix(monkeypatch: pytest.MonkeyPatch) -> None:
p, session = _provider(monkeypatch, [NOT_FOUND, edges(node())])
assert p.search("The Last of Us (2023)", 2023, "tv") is not None
@@ -217,7 +191,3 @@ def test_search_term_with_a_quote_stays_inside_the_string(monkeypatch: pytest.Mo
p, session = _provider(monkeypatch, [NOT_FOUND, edges(node(text='The "Best" Show'))])
p.search('The "Best" Show', None, "tv")
assert 'searchTerm: "The \\"Best\\" Show"' in session.posts[0]["query"]
def test_get_external_ids_echoes_the_id() -> None:
assert IMDBProvider().get_external_ids("tt1375666", "movie").imdb_id == "tt1375666"