Add season-pack and sibling-prefix regression tests
This commit is contained in:
parent
cb054cbac7
commit
3153e66cc8
1 changed files with 63 additions and 0 deletions
|
|
@ -77,6 +77,69 @@ def run_script(scenario):
|
||||||
|
|
||||||
|
|
||||||
class SonarrImportSafetyTests(unittest.TestCase):
|
class SonarrImportSafetyTests(unittest.TestCase):
|
||||||
|
def test_fhd_scope_does_not_match_uhd_sibling_prefix(self):
|
||||||
|
exact = (
|
||||||
|
"/tdarr/converted/serien4k/Marshals.2026.S01.GERMAN.DUBBED/"
|
||||||
|
"Marshals.2026.S01E05.GERMAN.DUBBED.mkv"
|
||||||
|
)
|
||||||
|
result = run_script(
|
||||||
|
{
|
||||||
|
"releaseTitle": "Marshals.2026.S01E05.GERMAN.DUBBED",
|
||||||
|
"exactPath": exact,
|
||||||
|
"scopeRoot": "/tdarr/converted/serien",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(result["result"], 1)
|
||||||
|
self.assertEqual(result["calls"], [])
|
||||||
|
|
||||||
|
def test_season_pack_history_uses_exact_episode_filename_for_parse(self):
|
||||||
|
pack = "Marshals.2026.S01.GERMAN.DUBBED.DL.2160p.WEB.H265-TSCC"
|
||||||
|
episode = "Marshals.2026.S01E05.GERMAN.DUBBED.DL.2160p.WEB.H265-TSCC"
|
||||||
|
exact = f"/tdarr/converted/serien4k/{pack}/{episode}.mkv"
|
||||||
|
queue_records = [
|
||||||
|
{"title": pack, "seriesId": 600, "episodeId": 37500 + number}
|
||||||
|
for number in range(1, 14)
|
||||||
|
]
|
||||||
|
history_records = [
|
||||||
|
{
|
||||||
|
"sourceTitle": pack,
|
||||||
|
"seriesId": 600,
|
||||||
|
"episodeId": 37500 + number,
|
||||||
|
"eventType": "grabbed",
|
||||||
|
}
|
||||||
|
for number in range(1, 14)
|
||||||
|
]
|
||||||
|
result = run_script(
|
||||||
|
{
|
||||||
|
"releaseTitle": episode,
|
||||||
|
"exactPath": exact,
|
||||||
|
"scopeRoot": "/tdarr/converted/serien4k",
|
||||||
|
"queueResponse": {"records": queue_records},
|
||||||
|
"historyResponse": {"records": history_records},
|
||||||
|
"parseResponse": {
|
||||||
|
"series": {"id": 600, "title": "Marshals"},
|
||||||
|
"episodes": [{"id": 37505}],
|
||||||
|
},
|
||||||
|
"candidates": [
|
||||||
|
{
|
||||||
|
"path": exact,
|
||||||
|
"quality": {"quality": {"id": 19, "name": "WEBDL-2160p"}},
|
||||||
|
"languages": [{"id": 4, "name": "German"}],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(result["result"], 1)
|
||||||
|
command = next(call for call in result["calls"] if call["type"] == "command")
|
||||||
|
self.assertEqual(command["body"]["files"][0]["episodeIds"], [37505])
|
||||||
|
parse_call = next(
|
||||||
|
call for call in result["calls"]
|
||||||
|
if call["type"] == "fetch" and call["endpoint"] == "parse"
|
||||||
|
)
|
||||||
|
self.assertIn("s01e05", parse_call["query"].lower())
|
||||||
|
|
||||||
def test_percent_title_matches_queue_and_imports_exact_episode_file(self):
|
def test_percent_title_matches_queue_and_imports_exact_episode_file(self):
|
||||||
source_title = (
|
source_title = (
|
||||||
"100%.Wolf.S01E01.Die.Aufnahmeprufung.German.1080p."
|
"100%.Wolf.S01E01.Die.Aufnahmeprufung.German.1080p."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue