|
9 | 9 |
|
10 | 10 | from ytdl_sub.cli.entrypoint import _download_subscriptions_from_yaml_files |
11 | 11 | from ytdl_sub.cli.entrypoint import main |
| 12 | +from ytdl_sub.config.config_file import ConfigFile |
12 | 13 | from ytdl_sub.subscriptions.subscription import Subscription |
13 | 14 | from ytdl_sub.utils.exceptions import ExperimentalFeatureNotEnabled |
14 | 15 |
|
@@ -59,6 +60,7 @@ def test_subscription_logs_write_to_file( |
59 | 60 | subscription_override_dict={}, |
60 | 61 | update_with_info_json=False, |
61 | 62 | dry_run=dry_run, |
| 63 | + shuffle=False, |
62 | 64 | ) |
63 | 65 | except ValueError: |
64 | 66 | assert not mock_success_output |
@@ -120,3 +122,40 @@ def test_update_with_info_json_requires_experimental_flag( |
120 | 122 | pytest.raises(ExperimentalFeatureNotEnabled), |
121 | 123 | ): |
122 | 124 | _ = main() |
| 125 | + |
| 126 | + |
| 127 | +def test_subscription_shuffle( |
| 128 | + default_config: ConfigFile, |
| 129 | + mock_subscription_download_factory: Callable, |
| 130 | + music_video_subscription_path: Path, |
| 131 | +): |
| 132 | + |
| 133 | + subscription_paths = [str(music_video_subscription_path)] |
| 134 | + |
| 135 | + with ( |
| 136 | + patch.object( |
| 137 | + Subscription, |
| 138 | + "download", |
| 139 | + new=mock_subscription_download_factory(mock_success_output=True), |
| 140 | + ), |
| 141 | + ): |
| 142 | + out1 = _download_subscriptions_from_yaml_files( |
| 143 | + config=default_config, |
| 144 | + subscription_paths=subscription_paths, |
| 145 | + subscription_matches=[], |
| 146 | + subscription_override_dict={}, |
| 147 | + update_with_info_json=False, |
| 148 | + dry_run=True, |
| 149 | + shuffle=True, |
| 150 | + ) |
| 151 | + out2 = _download_subscriptions_from_yaml_files( |
| 152 | + config=default_config, |
| 153 | + subscription_paths=subscription_paths, |
| 154 | + subscription_matches=[], |
| 155 | + subscription_override_dict={}, |
| 156 | + update_with_info_json=False, |
| 157 | + dry_run=True, |
| 158 | + shuffle=True, |
| 159 | + ) |
| 160 | + |
| 161 | + assert [sub.name for sub in out1] != [sub.name for sub in out2] |
0 commit comments