Initial productized Importarr service
This commit is contained in:
@@ -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"
|
||||
Reference in New Issue
Block a user