From 14e98f014bfd73679677ae2c603fc4823fe2e0c2 Mon Sep 17 00:00:00 2001 From: Serene-Arc Date: Thu, 29 Sep 2022 18:18:44 +1000 Subject: [PATCH] Add test cases --- tests/test_download_filter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_download_filter.py b/tests/test_download_filter.py index 5def10c..ce1b260 100644 --- a/tests/test_download_filter.py +++ b/tests/test_download_filter.py @@ -11,7 +11,7 @@ from bdfr.resource import Resource @pytest.fixture() def download_filter() -> DownloadFilter: - return DownloadFilter(['mp4', 'mp3'], ['test.com', 'reddit.com']) + return DownloadFilter(['mp4', 'mp3'], ['test.com', 'reddit.com', 'img.example.com']) @pytest.mark.parametrize(('test_extension', 'expected'), ( @@ -31,6 +31,9 @@ def test_filter_extension(test_extension: str, expected: bool, download_filter: ('http://reddit.com/test.gif', False), ('https://www.example.com/test.mp4', True), ('https://www.example.com/test.png', True), + ('https://i.example.com/test.png', True), + ('https://img.example.com/test.png', False), + ('https://i.test.com/test.png', False), )) def test_filter_domain(test_url: str, expected: bool, download_filter: DownloadFilter): result = download_filter._check_domain(test_url)