@@ -28,3 +28,28 @@ def test_manual_batch_completes_when_empty(tmp_path, monkeypatch):
|
||||
rows = main.state.list_manual_batches()
|
||||
assert rows[0]["status"] == "completed"
|
||||
assert (movies / "Movie.mkv").exists()
|
||||
|
||||
|
||||
def test_manual_queue_items_are_persisted_and_imported(tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("IMPORTARR_STATE_PATH", str(tmp_path / "initial.db"))
|
||||
import importarr.main as main
|
||||
|
||||
download = tmp_path / "downloads"
|
||||
movies = tmp_path / "movies"
|
||||
tv = tmp_path / "tv"
|
||||
batch = download / "Release"
|
||||
batch.mkdir(parents=True)
|
||||
(batch / "Movie.mkv").write_bytes(b"movie")
|
||||
monkeypatch.setattr(main, "settings", Settings(download_root=download, movies_root=movies, tv_root=tv, state_path=tmp_path / "state.db"))
|
||||
monkeypatch.setattr(main, "state", State(tmp_path / "state.db"))
|
||||
main.state.add_manual_batch(batch)
|
||||
|
||||
main.sync_manual_queue()
|
||||
queued = main.state.list_queue_items()
|
||||
assert len(queued) == 1
|
||||
assert queued[0]["source_type"] == "manual"
|
||||
assert queued[0]["state"] == "manual_batch"
|
||||
|
||||
assert main._import_manual_batches(main.Importer(movies, tv)) == 1
|
||||
assert main.state.list_queue_items() == []
|
||||
assert main.state.list_queue_items(active_only=False)[0]["state"] == "imported"
|
||||
|
||||
@@ -27,6 +27,12 @@ def test_queue_item_not_ready():
|
||||
assert result.state == "processing"
|
||||
|
||||
|
||||
def test_force_status_overrides_queue_and_processing_status():
|
||||
result = classify_history_item(item(status="Extracting"), {"1"}, "manual", ROOT, force_status=True)
|
||||
assert result.ready
|
||||
assert result.storage == ROOT / "Movie"
|
||||
|
||||
|
||||
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"
|
||||
@@ -39,3 +45,8 @@ def test_empty_storage_unknown():
|
||||
def test_unpack_path_not_ready():
|
||||
result = classify_history_item(item(storage=str(ROOT / "_UNPACK_Movie")), set(), "manual", ROOT)
|
||||
assert result.state == "processing"
|
||||
|
||||
|
||||
def test_force_status_keeps_transient_path_safety():
|
||||
result = classify_history_item(item(storage=str(ROOT / "_UNPACK_Movie"), status="Extracting"), {"1"}, "manual", ROOT, force_status=True)
|
||||
assert result.state == "processing"
|
||||
|
||||
Reference in New Issue
Block a user