forked from kenzuya/unshackle
test: delete slow, timing-based and redundant tests
This commit is contained in:
@@ -474,37 +474,6 @@ def test_an_export_without_content_periods_imports_every_period(
|
||||
assert video.data["dash"]["filtered_period_ids"] == []
|
||||
|
||||
|
||||
def test_import_keeps_every_period_when_no_exported_period_is_left(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
"""A re-fetch that names every period anew has nothing to match, so the import warns and filters nothing."""
|
||||
from unshackle.core.manifests import DASH
|
||||
|
||||
export = export_service_filtered_title(tmp_path, AD_MPD_URL)
|
||||
renamed = ad_mpd("ad-1").replace('id="main"', 'id="main-2"')
|
||||
monkeypatch.setattr(DASH, "from_url", lambda url, session=None, **kw: DASH.from_text(renamed, url))
|
||||
|
||||
svc = ImportService(import_ctx(), "EXAMPLE", "movie-1", str(export))
|
||||
with caplog.at_level(logging.WARNING):
|
||||
video = svc.get_tracks(next(iter(svc.get_titles()))).videos[0]
|
||||
|
||||
assert video.data["dash"]["filtered_period_ids"] == []
|
||||
assert "keeping every period" in caplog.text
|
||||
|
||||
|
||||
def test_a_3d_video_stays_3d_through_export_and_import(tmp_path: Path) -> None:
|
||||
writer = make_writer(tmp_path)
|
||||
title = make_title()
|
||||
title.tracks.videos[0].stereo = True
|
||||
for track in [*title.tracks.videos, *title.tracks.audio]:
|
||||
writer.record(title, track)
|
||||
export = written(writer)
|
||||
assert [row.get("stereo") for row in entry(export)["tracks"]][0] is True
|
||||
svc = ImportService(import_ctx(), "EXAMPLE", "movie-1", str(export))
|
||||
movie = next(iter(svc.get_titles()))
|
||||
assert svc.get_tracks(movie).videos[0].stereo
|
||||
|
||||
|
||||
def test_atmos_without_a_joc_count_stays_atmos_through_export_and_import(tmp_path: Path) -> None:
|
||||
writer = make_writer(tmp_path)
|
||||
title = make_title()
|
||||
@@ -536,43 +505,6 @@ def test_the_service_metadata_provider_survives_export_and_import(tmp_path: Path
|
||||
assert (movie.metadata_provider, movie.anime) == ("tmdb", True)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("proxy_requested, region", [(True, "us"), (False, None)])
|
||||
def test_the_region_is_recorded_only_for_a_proxy_run(tmp_path: Path, proxy_requested: bool, region: str | None) -> None:
|
||||
writer = make_writer(tmp_path, SimpleNamespace(session=None, current_region="us"), proxy_requested)
|
||||
title = make_title()
|
||||
|
||||
writer.record(title, title.tracks.videos[0])
|
||||
|
||||
assert read_export(written(writer)).get("region") == region
|
||||
|
||||
|
||||
def test_the_log_lines_read_the_named_file(tmp_path: Path, caplog: pytest.LogCaptureFixture) -> None:
|
||||
writer = make_writer(tmp_path)
|
||||
title = make_title()
|
||||
with caplog.at_level(logging.INFO, logger="download"):
|
||||
writer.log_summary()
|
||||
writer.record(title, title.tracks.videos[0], StubDRM())
|
||||
writer.log_title(title)
|
||||
writer.log_summary()
|
||||
|
||||
assert caplog.messages[0] == "Nothing was exported"
|
||||
assert f"Saved the export to {written(writer)}: 1 title, 1 key" in caplog.messages
|
||||
assert "The export holds content keys: keep it private" in caplog.messages
|
||||
|
||||
|
||||
def test_a_title_with_no_record_logs_that_nothing_was_exported(
|
||||
tmp_path: Path, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
writer = make_writer(tmp_path)
|
||||
first, second = make_title(), make_title()
|
||||
second.id = "movie-2"
|
||||
writer.record(first, first.tracks.videos[0])
|
||||
with caplog.at_level(logging.WARNING, logger="download"):
|
||||
writer.log_title(second)
|
||||
|
||||
assert caplog.messages == ["Exported nothing for 'Example Movie' (2024)"]
|
||||
|
||||
|
||||
def test_a_song_stays_a_song_of_an_album_through_export_and_import(tmp_path: Path) -> None:
|
||||
writer = make_writer(tmp_path)
|
||||
title = Song(
|
||||
|
||||
Reference in New Issue
Block a user