From 57b2ac36c0bf7183493635296e8ccf7f0a94f2c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Arnauts?= Date: Sat, 28 Nov 2020 17:13:21 +0100 Subject: [PATCH] Fix CI tests (#59) --- Makefile | 2 +- requirements.txt | 1 + resources/lib/modules/player.py | 2 +- resources/lib/viervijfzes/auth.py | 2 +- tests/test_api.py | 3 +-- tests/test_epg.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index decab97..cce95ba 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ test: test-unit test-unit: @echo ">>> Running unit tests" - @$(PYTHON) -m unittest discover -v -b -f + @$(PYTHON) -m pytest tests clean: @find . -name '*.py[cod]' -type f -delete diff --git a/requirements.txt b/requirements.txt index 6d90099..dfdff7a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ coverage polib pylint +pytest python-dateutil requests git+git://github.com/dagwieers/kodi-plugin-routing.git@setup#egg=routing diff --git a/resources/lib/modules/player.py b/resources/lib/modules/player.py index b111607..3ee1b18 100644 --- a/resources/lib/modules/player.py +++ b/resources/lib/modules/player.py @@ -120,7 +120,7 @@ class Player: return resolved_stream except (InvalidLoginException, AuthenticationException) as ex: - _LOGGER.error(ex) + _LOGGER.exception(ex) kodiutils.ok_dialog(message=kodiutils.localize(30702, error=str(ex))) kodiutils.end_of_directory() return None diff --git a/resources/lib/viervijfzes/auth.py b/resources/lib/viervijfzes/auth.py index a60ff53..ebd5964 100644 --- a/resources/lib/viervijfzes/auth.py +++ b/resources/lib/viervijfzes/auth.py @@ -74,7 +74,7 @@ class AuthApi: # Store new tokens in cache if not os.path.exists(self._token_path): - os.mkdir(self._token_path) + os.makedirs(self._token_path) with open(os.path.join(self._token_path, self.TOKEN_FILE), 'w') as fdesc: data = json.dumps(dict( id_token=self._id_token, diff --git a/tests/test_api.py b/tests/test_api.py index 848c579..5381012 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -64,8 +64,7 @@ class TestApi(unittest.TestCase): @unittest.skipUnless(kodiutils.get_setting('username') and kodiutils.get_setting('password'), 'Skipping since we have no credentials.') def test_get_drm_stream(self): - # https://www.zestv.be/video/ncis-new-orleans/ncis-new-orleans-seizoen-3/ncis-new-orleans-s3-aflevering-8 - resolved_stream = self._api.get_stream_by_uuid('5bd7211d-de78-490f-b40c-bacbee5919d2') + resolved_stream = self._api.get_stream_by_uuid('b56a41d9-5a6a-4ff0-b16a-56dc7b2e1f25') self.assertIsInstance(resolved_stream, ResolvedStream) diff --git a/tests/test_epg.py b/tests/test_epg.py index f83fbf5..794e0ab 100644 --- a/tests/test_epg.py +++ b/tests/test_epg.py @@ -45,7 +45,7 @@ class TestEpg(unittest.TestCase): self.assertEqual(programs, []) def test_play_video_from_epg(self): - epg_programs = self._epg.get_epg('vier', date.today().strftime('%Y-%m-%d')) + epg_programs = self._epg.get_epg('vier', 'yesterday') epg_program = [program for program in epg_programs if program.video_url][0] # Lookup the Episode data since we don't have an UUID