Initial productized Importarr service

This commit is contained in:
2026-07-29 11:37:57 +02:00
commit 577ea97d46
25 changed files with 886 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
from pathlib import Path
from importarr.readiness import classify_history_item
ROOT = Path("/tmp/downloads/manual")
def item(**kwargs):
data = {"nzo_id": "1", "category": "manual", "status": "Completed", "storage": str(ROOT / "Movie")}
data.update(kwargs)
return data
def test_completed_manual_is_ready():
result = classify_history_item(item(), set(), "manual", ROOT)
assert result.ready
def test_wrong_category_ignored():
result = classify_history_item(item(category="*"), set(), "manual", ROOT)
assert result.state == "ignored"
def test_queue_item_not_ready():
result = classify_history_item(item(), {"1"}, "manual", ROOT)
assert result.state == "processing"
def test_post_processing_not_ready():
for status in ["Queued", "Repairing", "Extracting", "Moving"]:
assert classify_history_item(item(status=status), set(), "manual", ROOT).state == "processing"
def test_empty_storage_unknown():
assert classify_history_item(item(storage=""), set(), "manual", ROOT).state == "unknown"
def test_unpack_path_not_ready():
result = classify_history_item(item(storage=str(ROOT / "_UNPACK_Movie")), set(), "manual", ROOT)
assert result.state == "processing"