Fail closed on wrong-series season-pack releases #10
1 changed files with 35 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ class FakeSonarr {
|
||||||
calls.push({type: 'fetch', endpoint, query});
|
calls.push({type: 'fetch', endpoint, query});
|
||||||
if (endpoint === 'queue') return scenario.queueResponse || {records: []};
|
if (endpoint === 'queue') return scenario.queueResponse || {records: []};
|
||||||
if (endpoint === 'history') return scenario.historyResponse || {records: []};
|
if (endpoint === 'history') return scenario.historyResponse || {records: []};
|
||||||
|
if (endpoint.startsWith('series/')) return scenario.seriesResponse || {};
|
||||||
if (endpoint === 'episode') return scenario.episodeResponse || [];
|
if (endpoint === 'episode') return scenario.episodeResponse || [];
|
||||||
if (endpoint === 'parse') return scenario.parseResponse || {};
|
if (endpoint === 'parse') return scenario.parseResponse || {};
|
||||||
if (endpoint === 'manualimport') return scenario.candidates || [];
|
if (endpoint === 'manualimport') return scenario.candidates || [];
|
||||||
|
|
@ -105,6 +106,7 @@ class SonarrImportSafetyTests(unittest.TestCase):
|
||||||
"scopeRoot": "/tdarr/converted/serien",
|
"scopeRoot": "/tdarr/converted/serien",
|
||||||
"queueResponse": {"records": queue_records},
|
"queueResponse": {"records": queue_records},
|
||||||
"historyResponse": {"records": history_records},
|
"historyResponse": {"records": history_records},
|
||||||
|
"seriesResponse": {"id": 794, "title": "Lucky", "cleanTitle": "lucky"},
|
||||||
"episodeResponse": [
|
"episodeResponse": [
|
||||||
{"id": 64000 + number, "seasonNumber": 1, "episodeNumber": number}
|
{"id": 64000 + number, "seasonNumber": 1, "episodeNumber": number}
|
||||||
for number in range(1, 8)
|
for number in range(1, 8)
|
||||||
|
|
@ -127,6 +129,38 @@ class SonarrImportSafetyTests(unittest.TestCase):
|
||||||
self.assertEqual(imported["episodeIds"], [64005])
|
self.assertEqual(imported["episodeIds"], [64005])
|
||||||
self.assertEqual(imported["releaseGroup"], "FritzBox")
|
self.assertEqual(imported["releaseGroup"], "FritzBox")
|
||||||
|
|
||||||
|
def test_pack_resolution_fails_closed_when_tracked_series_title_differs(self):
|
||||||
|
pack = "Lucky.S01.Complete.2026.GERMAN.aac.720p.WEB.h265-FritzBox"
|
||||||
|
episode = "Lucky.S01E05.Are.We.Bad.People.2026.GERMAN.aac.720p.WEB.h265-FritzBox"
|
||||||
|
exact = f"/tdarr/converted/serien/{pack}/{episode}.mp4"
|
||||||
|
result = run_script(
|
||||||
|
{
|
||||||
|
"releaseTitle": episode,
|
||||||
|
"exactPath": exact,
|
||||||
|
"scopeRoot": "/tdarr/converted/serien",
|
||||||
|
"queueResponse": {
|
||||||
|
"records": [
|
||||||
|
{"title": pack, "seriesId": 794, "episodeId": 64000 + number}
|
||||||
|
for number in range(1, 8)
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"historyResponse": {"records": []},
|
||||||
|
"seriesResponse": {"id": 794, "title": "Dutton Ranch", "cleanTitle": "duttonranch"},
|
||||||
|
"episodeResponse": [
|
||||||
|
{"id": 64005, "seasonNumber": 1, "episodeNumber": 5}
|
||||||
|
],
|
||||||
|
"parseResponse": {
|
||||||
|
"series": {"id": 821, "title": "Lucky"},
|
||||||
|
"episodes": [{"id": 61648}],
|
||||||
|
},
|
||||||
|
"candidates": [{"path": exact, "quality": {"quality": {"id": 6}}}],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(result["result"], -1)
|
||||||
|
self.assertFalse(any(call["type"] == "command" for call in result["calls"]))
|
||||||
|
self.assertFalse(any(call.get("endpoint") == "parse" for call in result["calls"]))
|
||||||
|
|
||||||
def test_pack_resolution_fails_closed_when_series_ids_differ(self):
|
def test_pack_resolution_fails_closed_when_series_ids_differ(self):
|
||||||
pack = "Lucky.S01.Complete.2026.GERMAN.aac.720p.WEB.h265-FritzBox"
|
pack = "Lucky.S01.Complete.2026.GERMAN.aac.720p.WEB.h265-FritzBox"
|
||||||
episode = "Lucky.S01E05.German.Title.2026.GERMAN.aac.720p.WEB.h265-FritzBox"
|
episode = "Lucky.S01E05.German.Title.2026.GERMAN.aac.720p.WEB.h265-FritzBox"
|
||||||
|
|
@ -194,6 +228,7 @@ class SonarrImportSafetyTests(unittest.TestCase):
|
||||||
"scopeRoot": "/tdarr/converted/serien4k",
|
"scopeRoot": "/tdarr/converted/serien4k",
|
||||||
"queueResponse": {"records": queue_records},
|
"queueResponse": {"records": queue_records},
|
||||||
"historyResponse": {"records": history_records},
|
"historyResponse": {"records": history_records},
|
||||||
|
"seriesResponse": {"id": 600, "title": "Marshals", "cleanTitle": "marshals"},
|
||||||
"parseResponse": {
|
"parseResponse": {
|
||||||
"series": {"id": 600, "title": "Marshals"},
|
"series": {"id": 600, "title": "Marshals"},
|
||||||
"episodes": [{"id": 37505}],
|
"episodes": [{"id": 37505}],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue