This commit is contained in:
Jesse Bannon 2023-10-27 00:05:05 -07:00
parent 22c3d76217
commit 6a0695d53d
2 changed files with 7 additions and 5 deletions

View file

@ -44,7 +44,7 @@ class TestDownloadArgsParser:
"aliases, cmd, expected_sub_dict", "aliases, cmd, expected_sub_dict",
[ [
( (
{"mv": "--preset music_video", "v": "--download.url"}, {"mv": "--preset 'Jellyfin Music Videos'", "v": "--download.url"},
"dl --mv --v 123abc", "dl --mv --v 123abc",
{"preset": "Jellyfin Music Videos", "download": {"url": "123abc"}}, {"preset": "Jellyfin Music Videos", "download": {"url": "123abc"}},
), ),

View file

@ -31,9 +31,11 @@ def test_subscription_logs_write_to_file(
mock_success_output: bool, mock_success_output: bool,
keep_successful_logs: bool, keep_successful_logs: bool,
): ):
num_subscriptions = 2 num_subscriptions = 3
num_runs = 2
config = persist_logs_config_factory(keep_successful_logs=keep_successful_logs) config = persist_logs_config_factory(keep_successful_logs=keep_successful_logs)
subscription_paths = [str(music_video_subscription_path)] * num_subscriptions subscription_paths = [str(music_video_subscription_path)] * num_runs
with patch.object( with patch.object(
Subscription, Subscription,
@ -59,7 +61,7 @@ def test_subscription_logs_write_to_file(
return return
# If not success, expect 2 log files for both sub errors # If not success, expect 2 log files for both sub errors
elif not mock_success_output: elif not mock_success_output:
assert len(log_directory_files) == 2 assert len(log_directory_files) == num_subscriptions
for log_path in log_directory_files: for log_path in log_directory_files:
assert bool(re.match(r"\d\.john_smith\.error\.log", log_path.name)) assert bool(re.match(r"\d\.john_smith\.error\.log", log_path.name))
with open(log_path, "r", encoding="utf-8") as log_file: with open(log_path, "r", encoding="utf-8") as log_file:
@ -70,7 +72,7 @@ def test_subscription_logs_write_to_file(
) )
# If success and success logging, expect 3 log files # If success and success logging, expect 3 log files
else: else:
assert len(log_directory_files) == num_subscriptions assert len(log_directory_files) == (num_runs * num_subscriptions)
for log_file_path in log_directory_files: for log_file_path in log_directory_files:
assert bool(re.match(r"\d\.john_smith\.success\.log", log_file_path.name)) assert bool(re.match(r"\d\.john_smith\.success\.log", log_file_path.name))
with open(log_file_path, "r", encoding="utf-8") as log_file: with open(log_file_path, "r", encoding="utf-8") as log_file: