Fixed platform filter. Fixes #18

This commit is contained in:
Eddy Hintze
2020-02-22 13:54:57 -05:00
parent c1e1df35fe
commit ccff521927
5 changed files with 48 additions and 2 deletions

View File

@@ -1,6 +1,9 @@
from humblebundle_downloader.download_library import DownloadLibrary
###
# _should_download_file_type
###
def test_include_logic_has_values():
dl = DownloadLibrary(
'fake_cookie_path',
@@ -47,3 +50,36 @@ def test_exclude_logic_empty():
assert dl._should_download_file_type('df') is True
assert dl._should_download_file_type('EPub') is True
assert dl._should_download_file_type('mobi') is True
###
# _should_download_platform
###
def test_download_platform_filter_none():
dl = DownloadLibrary(
'fake_cookie_path',
'fake_library_path',
platform_include=None,
)
assert dl._should_download_platform('ebook') is True
assert dl._should_download_platform('audio') is True
def test_download_platform_filter_blank():
dl = DownloadLibrary(
'fake_cookie_path',
'fake_library_path',
platform_include=[],
)
assert dl._should_download_platform('ebook') is True
assert dl._should_download_platform('audio') is True
def test_download_platform_filter_audio():
dl = DownloadLibrary(
'fake_cookie_path',
'fake_library_path',
platform_include=['audio'],
)
assert dl._should_download_platform('ebook') is False
assert dl._should_download_platform('audio') is True