From fd59759892de2b139d5c6780152cebc96d727f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Arnauts?= Date: Tue, 24 Mar 2020 22:20:24 +0100 Subject: [PATCH] Allow to run tests without authentication --- test/test_api.py | 3 +-- test/test_auth.py | 1 + test/test_epg.py | 10 +--------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/test/test_api.py b/test/test_api.py index ac505e1..ad256c2 100644 --- a/test/test_api.py +++ b/test/test_api.py @@ -37,6 +37,7 @@ class TestApi(unittest.TestCase): program_by_uuid = self._api.get_program_by_uuid(program.uuid) self.assertIsInstance(program_by_uuid, Program) + @unittest.skipUnless(kodiutils.get_setting('username') and kodiutils.get_setting('password'), 'Skipping since we have no credentials.') def test_get_stream(self): program = self._api.get_program('vier', 'auwch') episode = program.episodes[0] @@ -44,8 +45,6 @@ class TestApi(unittest.TestCase): video = self._api.get_stream_by_uuid(episode.uuid) self.assertTrue(video) - _LOGGER.info('Got video URL: %s', video) - if __name__ == '__main__': unittest.main() diff --git a/test/test_auth.py b/test/test_auth.py index 9109bd6..de83c9e 100644 --- a/test/test_auth.py +++ b/test/test_auth.py @@ -18,6 +18,7 @@ class TestAuth(unittest.TestCase): def __init__(self, *args, **kwargs): super(TestAuth, self).__init__(*args, **kwargs) + @unittest.skipUnless(kodiutils.get_setting('username') and kodiutils.get_setting('password'), 'Skipping since we have no credentials.') def test_login(self): # Clear any cache we have AuthApi.clear_tokens() diff --git a/test/test_epg.py b/test/test_epg.py index 569499f..87d9da2 100644 --- a/test/test_epg.py +++ b/test/test_epg.py @@ -9,8 +9,6 @@ import logging import unittest from datetime import date -from resources.lib import kodiutils -from resources.lib.viervijfzes.auth import AuthApi from resources.lib.viervijfzes.content import ContentApi, Episode from resources.lib.viervijfzes.epg import EpgApi, EpgProgram @@ -49,17 +47,11 @@ class TestEpg(unittest.TestCase): epg_programs = self._epg.get_epg('vier', date.today().strftime('%Y-%m-%d')) epg_program = [program for program in epg_programs if program.video_url][0] - auth = AuthApi(kodiutils.get_setting('username'), kodiutils.get_setting('password')) - api = ContentApi(auth) - # Lookup the Episode data since we don't have an UUID + api = ContentApi() episode = api.get_episode(epg_program.channel, epg_program.video_url) self.assertIsInstance(episode, Episode) - # Get stream based on the Episode's UUID - video = api.get_stream_by_uuid(episode.uuid) - self.assertTrue(video) - if __name__ == '__main__': unittest.main()