mirror of
https://github.com/ManiMatter/decluttarr.git
synced 2026-04-18 09:54:04 +02:00
Formatting issues
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
|
||||
from src.utils.queue_manager import QueueManager
|
||||
@@ -11,11 +12,13 @@ def fixture_mock_queue_manager():
|
||||
mock_settings = Mock()
|
||||
return QueueManager(arr=mock_arr, settings=mock_settings)
|
||||
|
||||
|
||||
# ---------- Tests ----------
|
||||
def test_format_queue_empty(mock_queue_manager):
|
||||
result = mock_queue_manager.format_queue([])
|
||||
assert result == "empty"
|
||||
|
||||
|
||||
def test_format_queue_single_item(mock_queue_manager):
|
||||
queue_items = [
|
||||
{
|
||||
@@ -37,6 +40,7 @@ def test_format_queue_single_item(mock_queue_manager):
|
||||
result = mock_queue_manager.format_queue(queue_items)
|
||||
assert result == expected
|
||||
|
||||
|
||||
def test_format_queue_multiple_same_download_id(mock_queue_manager):
|
||||
queue_items = [
|
||||
{
|
||||
@@ -52,7 +56,7 @@ def test_format_queue_multiple_same_download_id(mock_queue_manager):
|
||||
"protocol": "usenet",
|
||||
"status": "downloading",
|
||||
"id": 2,
|
||||
}
|
||||
},
|
||||
]
|
||||
expected = {
|
||||
"xyz789": {
|
||||
@@ -65,6 +69,7 @@ def test_format_queue_multiple_same_download_id(mock_queue_manager):
|
||||
result = mock_queue_manager.format_queue(queue_items)
|
||||
assert result == expected
|
||||
|
||||
|
||||
def test_format_queue_multiple_different_download_ids(mock_queue_manager):
|
||||
queue_items = [
|
||||
{
|
||||
@@ -80,21 +85,21 @@ def test_format_queue_multiple_different_download_ids(mock_queue_manager):
|
||||
"protocol": "usenet",
|
||||
"status": "completed",
|
||||
"id": 20,
|
||||
}
|
||||
},
|
||||
]
|
||||
expected = {
|
||||
'aaa111': {
|
||||
'queue_ids': [10],
|
||||
'title': 'Example Download Title A',
|
||||
'protocol': 'torrent',
|
||||
'status': 'queued'
|
||||
"aaa111": {
|
||||
"queue_ids": [10],
|
||||
"title": "Example Download Title A",
|
||||
"protocol": "torrent",
|
||||
"status": "queued",
|
||||
},
|
||||
"bbb222": {
|
||||
"queue_ids": [20],
|
||||
"title": "Example Download Title B",
|
||||
"protocol": "usenet",
|
||||
"status": "completed",
|
||||
},
|
||||
'bbb222': {
|
||||
'queue_ids': [20],
|
||||
'title': 'Example Download Title B',
|
||||
'protocol': 'usenet',
|
||||
'status': 'completed'
|
||||
}
|
||||
}
|
||||
result = mock_queue_manager.format_queue(queue_items)
|
||||
assert result == expected
|
||||
|
||||
Reference in New Issue
Block a user