from importarr.state import State def test_delete_queue_items_by_state_can_target_reason(tmp_path): state = State(tmp_path / "state.db") state.upsert_queue_item(source_type="sab", source_id="stale", name="Stale", state="ignored", reason="SAB category is not owned by Importarr") state.upsert_queue_item(source_type="sab", source_id="other", name="Other", state="ignored", reason="other reason") assert state.delete_queue_items_by_state("sab", "ignored", "SAB category is not owned by Importarr") == 1 rows = state.list_queue_items() assert len(rows) == 1 assert rows[0]["source_id"] == "other"