1
0
Fork 0
mirror of synced 2024-09-28 07:12:07 +12:00

Add test cases

This commit is contained in:
Serene-Arc 2022-09-29 18:18:44 +10:00
parent 0ce2585f7f
commit 14e98f014b

View file

@ -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)