Allow to run tests without authentication
This commit is contained in:
parent
f15adcf7f3
commit
fd59759892
@ -37,6 +37,7 @@ class TestApi(unittest.TestCase):
|
|||||||
program_by_uuid = self._api.get_program_by_uuid(program.uuid)
|
program_by_uuid = self._api.get_program_by_uuid(program.uuid)
|
||||||
self.assertIsInstance(program_by_uuid, Program)
|
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):
|
def test_get_stream(self):
|
||||||
program = self._api.get_program('vier', 'auwch')
|
program = self._api.get_program('vier', 'auwch')
|
||||||
episode = program.episodes[0]
|
episode = program.episodes[0]
|
||||||
@ -44,8 +45,6 @@ class TestApi(unittest.TestCase):
|
|||||||
video = self._api.get_stream_by_uuid(episode.uuid)
|
video = self._api.get_stream_by_uuid(episode.uuid)
|
||||||
self.assertTrue(video)
|
self.assertTrue(video)
|
||||||
|
|
||||||
_LOGGER.info('Got video URL: %s', video)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@ -18,6 +18,7 @@ class TestAuth(unittest.TestCase):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(TestAuth, self).__init__(*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):
|
def test_login(self):
|
||||||
# Clear any cache we have
|
# Clear any cache we have
|
||||||
AuthApi.clear_tokens()
|
AuthApi.clear_tokens()
|
||||||
|
@ -9,8 +9,6 @@ import logging
|
|||||||
import unittest
|
import unittest
|
||||||
from datetime import date
|
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.content import ContentApi, Episode
|
||||||
from resources.lib.viervijfzes.epg import EpgApi, EpgProgram
|
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_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]
|
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
|
# Lookup the Episode data since we don't have an UUID
|
||||||
|
api = ContentApi()
|
||||||
episode = api.get_episode(epg_program.channel, epg_program.video_url)
|
episode = api.get_episode(epg_program.channel, epg_program.video_url)
|
||||||
self.assertIsInstance(episode, Episode)
|
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__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user