Added tests to run in ci. Updated tests.

This commit is contained in:
Eddy Hintze 2021-05-21 12:55:34 +00:00
parent c8aba1179a
commit c107b65e01
4 changed files with 7 additions and 9 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*egg-info *egg-info
__pycache__ __pycache__
*cookies.txt *cookies.txt
.tox/

View File

@ -37,7 +37,6 @@ class DownloadLibrary:
platform_include = [] platform_include = []
self.platform_include = list(map(str.lower, platform_include)) self.platform_include = list(map(str.lower, platform_include))
self.cache_file = os.path.join(library_path, '.cache.json')
self.purchase_keys = purchase_keys self.purchase_keys = purchase_keys
self.trove = trove self.trove = trove
self.update = update self.update = update
@ -59,6 +58,7 @@ class DownloadLibrary:
def start(self): def start(self):
self.cache_file = os.path.join(self.library_path, '.cache.json')
self.cache_data = self._load_cache_data(self.cache_file) self.cache_data = self._load_cache_data(self.cache_file)
self.purchase_keys = self.purchase_keys if self.purchase_keys else self._get_purchase_keys() # noqa: E501 self.purchase_keys = self.purchase_keys if self.purchase_keys else self._get_purchase_keys() # noqa: E501

View File

@ -6,7 +6,6 @@ from humblebundle_downloader.download_library import DownloadLibrary
### ###
def test_include_logic_has_values(): def test_include_logic_has_values():
dl = DownloadLibrary( dl = DownloadLibrary(
'fake_cookie_path',
'fake_library_path', 'fake_library_path',
ext_include=['pdf', 'EPub'], ext_include=['pdf', 'EPub'],
) )
@ -18,7 +17,6 @@ def test_include_logic_has_values():
def test_include_logic_empty(): def test_include_logic_empty():
dl = DownloadLibrary( dl = DownloadLibrary(
'fake_cookie_path',
'fake_library_path', 'fake_library_path',
ext_include=[], ext_include=[],
) )
@ -30,7 +28,6 @@ def test_include_logic_empty():
def test_exclude_logic_has_values(): def test_exclude_logic_has_values():
dl = DownloadLibrary( dl = DownloadLibrary(
'fake_cookie_path',
'fake_library_path', 'fake_library_path',
ext_exclude=['pdf', 'EPub'], ext_exclude=['pdf', 'EPub'],
) )
@ -42,7 +39,6 @@ def test_exclude_logic_has_values():
def test_exclude_logic_empty(): def test_exclude_logic_empty():
dl = DownloadLibrary( dl = DownloadLibrary(
'fake_cookie_path',
'fake_library_path', 'fake_library_path',
ext_exclude=[], ext_exclude=[],
) )
@ -57,7 +53,6 @@ def test_exclude_logic_empty():
### ###
def test_download_platform_filter_none(): def test_download_platform_filter_none():
dl = DownloadLibrary( dl = DownloadLibrary(
'fake_cookie_path',
'fake_library_path', 'fake_library_path',
platform_include=None, platform_include=None,
) )
@ -67,7 +62,6 @@ def test_download_platform_filter_none():
def test_download_platform_filter_blank(): def test_download_platform_filter_blank():
dl = DownloadLibrary( dl = DownloadLibrary(
'fake_cookie_path',
'fake_library_path', 'fake_library_path',
platform_include=[], platform_include=[],
) )
@ -77,7 +71,6 @@ def test_download_platform_filter_blank():
def test_download_platform_filter_audio(): def test_download_platform_filter_audio():
dl = DownloadLibrary( dl = DownloadLibrary(
'fake_cookie_path',
'fake_library_path', 'fake_library_path',
platform_include=['audio'], platform_include=['audio'],
) )

View File

@ -1,6 +1,10 @@
[tox] [tox]
envlist = flake8 envlist = flake8, py36
[testenv]
deps =
pytest
commands = pytest
[testenv:flake8] [testenv:flake8]
basepython = python3 basepython = python3