mirror of
https://github.com/ManiMatter/decluttarr.git
synced 2026-04-17 21:53:58 +02:00
Fixed typos and various linting issues such as PEP violations. Added ruff and fixed common issues and linting issues.
50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
import pytest
|
|
|
|
from src.jobs.remove_orphans import RemoveOrphans
|
|
from tests.jobs.test_utils import removal_job_fix
|
|
|
|
|
|
@pytest.fixture(name="queue_data")
|
|
def fixture_queue_data():
|
|
return [
|
|
{
|
|
"downloadId": "AABBCC",
|
|
"id": 1,
|
|
"title": "My Series A - Season 1",
|
|
"size": 1000,
|
|
"sizeleft": 500,
|
|
"downloadClient": "qBittorrent",
|
|
"protocol": "torrent",
|
|
"status": "paused",
|
|
"trackedDownloadState": "downloading",
|
|
"statusMessages": [],
|
|
},
|
|
{
|
|
"downloadId": "112233",
|
|
"id": 2,
|
|
"title": "My Series B - Season 1",
|
|
"size": 1000,
|
|
"sizeleft": 500,
|
|
"downloadClient": "qBittorrent",
|
|
"protocol": "torrent",
|
|
"status": "paused",
|
|
"trackedDownloadState": "downloading",
|
|
"statusMessages": [],
|
|
},
|
|
]
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_find_affected_items_returns_queue(queue_data):
|
|
# Fix
|
|
removal_job = removal_job_fix(RemoveOrphans, queue_data=queue_data)
|
|
|
|
# Act
|
|
affected_items = await removal_job._find_affected_items() # pylint: disable=W0212
|
|
|
|
# Assert
|
|
assert isinstance(affected_items, list)
|
|
assert len(affected_items) == 2 # noqa: PLR2004
|
|
assert affected_items[0]["downloadId"] == "AABBCC"
|
|
assert affected_items[1]["downloadId"] == "112233"
|