mirror of
https://github.com/ManiMatter/decluttarr.git
synced 2026-04-23 17:28:50 +02:00
Fix to tests
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
requests
|
||||
aiohttp
|
||||
asyncio
|
||||
python-dateutil
|
||||
verboselogs
|
||||
pytest
|
||||
pytest-asyncio
|
||||
requests==2.31.0
|
||||
asyncio==3.4.3
|
||||
python-dateutil==2.8.2
|
||||
verboselogs==1.7
|
||||
pytest==8.0.1
|
||||
pytest-asyncio==0.23.5
|
||||
|
||||
@@ -7,8 +7,8 @@ async def remove_slow(settings_dict, BASE_URL, API_KEY, NAME, deleted_downloads,
|
||||
# Detects slow downloads and triggers delete. Adds to blocklist
|
||||
try:
|
||||
failType = 'slow'
|
||||
logger.debug('remove_slow/queue IN: %s', formattedQueueInfo(queue))
|
||||
queue = await get_queue(BASE_URL, API_KEY)
|
||||
logger.debug('remove_slow/queue IN: %s', formattedQueueInfo(queue))
|
||||
if not queue: return 0
|
||||
# Find items affected
|
||||
affectedItems = []
|
||||
|
||||
@@ -7,8 +7,8 @@ async def remove_stalled(settings_dict, BASE_URL, API_KEY, NAME, deleted_downloa
|
||||
# Detects stalled and triggers repeat check and subsequent delete. Adds to blocklist
|
||||
try:
|
||||
failType = 'stalled'
|
||||
logger.debug('remove_stalled/queue IN: %s', formattedQueueInfo(queue))
|
||||
queue = await get_queue(BASE_URL, API_KEY)
|
||||
logger.debug('remove_stalled/queue IN: %s', formattedQueueInfo(queue))
|
||||
if not queue: return 0
|
||||
# Find items affected
|
||||
affectedItems = []
|
||||
|
||||
@@ -8,8 +8,8 @@ async def remove_unmonitored(settings_dict, BASE_URL, API_KEY, NAME, deleted_dow
|
||||
# Removes downloads belonging to movies/tv shows that are not monitored. Does not add to blocklist
|
||||
try:
|
||||
failType = 'unmonitored'
|
||||
logger.debug('remove_unmonitored/queue IN: %s', formattedQueueInfo(queue))
|
||||
queue = await get_queue(BASE_URL, API_KEY)
|
||||
logger.debug('remove_unmonitored/queue IN: %s', formattedQueueInfo(queue))
|
||||
if not queue: return 0
|
||||
# Find items affected
|
||||
monitoredDownloadIDs = []
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# pytest tests
|
||||
|
||||
# python3 -m pytest
|
||||
import pytest
|
||||
from src.utils.nest_functions import nested_set, add_keys_nested_dict, nested_get
|
||||
|
||||
# import asyncio
|
||||
|
||||
# Dictionary that is modified / queried as part of tests
|
||||
@@ -11,7 +11,6 @@ input_dict = { 1: {'name': 'Breaking Bad 1', 'data': {'episodes': 3
|
||||
|
||||
# @pytest.mark.asyncio
|
||||
# async def test_nested_set():
|
||||
@pytest
|
||||
def test_nested_set():
|
||||
expected_output = { 1: {'name': 'Breaking Bad 1', 'data': {'episodes': 3, 'year': 1991, 'actors': ['Peter', 'Paul', 'Ppacey']}},
|
||||
2: {'name': 'Breaking Bad 2', 'data': {'episodes': 6, 'year': 1994, 'actors': ['Weter', 'Waul', 'Wpacey']}},
|
||||
@@ -21,7 +20,6 @@ def test_nested_set():
|
||||
nested_set(output, [2, 'data' ,'year'], 1994)
|
||||
assert expected_output == output
|
||||
|
||||
@pytest
|
||||
def test_nested_set_conditions():
|
||||
input = { 1: [{'year': 2001, 'rating': 'high'}, {'year': 2002, 'rating': 'high'}, {'year': 2003, 'rating': 'high'}],
|
||||
2: [{'year': 2001, 'rating': 'high'}, {'year': 2002, 'rating': 'high'}, {'year': 2003, 'rating': 'high'}]}
|
||||
@@ -31,7 +29,6 @@ def test_nested_set_conditions():
|
||||
nested_set(output, [2, 'rating'], 'LOW', {'year': 2003})
|
||||
assert expected_output == output
|
||||
|
||||
@pytest
|
||||
def test_nested_set_conditions_multiple():
|
||||
input = { 1: [{'rating': 'high', 'color': 1, 'stack': 1}, {'rating': 'high', 'color': 2, 'stack': 2}, {'rating': 'high', 'color': 2, 'stack': 1}]}
|
||||
expected_output = { 1: [{'rating': 'high', 'color': 1, 'stack': 1}, {'rating': 'high', 'color': 2, 'stack': 2}, {'rating': 'LOW', 'color': 2, 'stack': 1}]}
|
||||
@@ -39,7 +36,6 @@ def test_nested_set_conditions_multiple():
|
||||
nested_set(output, [1, 'rating'], 'LOW', {'color': 2, 'stack': 1})
|
||||
assert expected_output == output
|
||||
|
||||
@pytest
|
||||
def test_add_keys_nested_dict():
|
||||
expected_output = { 1: {'name': 'Breaking Bad 1', 'data': {'episodes': 3, 'year': 1991, 'actors': ['Peter', 'Paul', 'Ppacey']}},
|
||||
2: {'name': 'Breaking Bad 2', 'data': {'episodes': 6, 'year': 1994, 'actors': ['Weter', 'Waul', 'Wpacey'], 'spaceship': True}},
|
||||
@@ -49,7 +45,6 @@ def test_add_keys_nested_dict():
|
||||
assert expected_output == output
|
||||
|
||||
|
||||
@pytest
|
||||
def test_nested_get():
|
||||
input = { 1: [{'name': 'A', 'color': 1, 'stack': 1}, {'name': 'B', 'color': 2, 'stack': 2}, {'name': 'C', 'color': 2, 'stack': 1}]}
|
||||
expected_output = ['C']
|
||||
|
||||
Reference in New Issue
Block a user