Improve code coverage (#9)

* Improve code coverage testing
This commit is contained in:
Michaël Arnauts 2020-03-23 16:30:25 +01:00 committed by GitHub
parent decd9a49f1
commit 9b94ba381d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 83 additions and 2 deletions

View File

@ -14,6 +14,14 @@ msgctxt "#30002"
msgid "Alphabetically sorted list of programs"
msgstr ""
msgctxt "#30003"
msgid "Catalogue"
msgstr ""
msgctxt "#30004"
msgid "TV Shows and Movies listed by category"
msgstr ""
msgctxt "#30007"
msgid "Channels"
msgstr ""

View File

@ -15,6 +15,14 @@ msgctxt "#30002"
msgid "Alphabetically sorted list of programs"
msgstr "Volledige lijst van programma's"
msgctxt "#30003"
msgid "Catalogue"
msgstr "Catalogus"
msgctxt "#30004"
msgid "TV Shows and Movies listed by category"
msgstr "Programma's en films per categorie"
msgctxt "#30007"
msgid "Channels"
msgstr "Kanalen"

View File

@ -31,10 +31,11 @@ class TestApi(unittest.TestCase):
program = self._api.get_program(channel, program)
self.assertIsInstance(program, Program)
self.assertIsInstance(program.seasons, dict)
# self.assertIsInstance(program.seasons[0], Season)
self.assertIsInstance(program.episodes, list)
self.assertIsInstance(program.episodes[0], Episode)
_LOGGER.info('Got program: %s', program)
program_by_uuid = self._api.get_program_by_uuid(program.uuid)
self.assertIsInstance(program_by_uuid, Program)
def test_get_stream(self):
program = self._api.get_program('vier', 'auwch')

64
test/test_routing.py Normal file
View File

@ -0,0 +1,64 @@
# -*- coding: utf-8 -*-
""" Tests for Routing """
# pylint: disable=missing-docstring,no-self-use
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
from resources.lib import addon
xbmc = __import__('xbmc')
xbmcaddon = __import__('xbmcaddon')
xbmcgui = __import__('xbmcgui')
xbmcplugin = __import__('xbmcplugin')
xbmcvfs = __import__('xbmcvfs')
routing = addon.routing
class TestRouting(unittest.TestCase):
""" Tests for Routing """
def __init__(self, *args, **kwargs):
super(TestRouting, self).__init__(*args, **kwargs)
def setUp(self):
# Don't warn that we don't close our HTTPS connections, this is on purpose.
# warnings.simplefilter("ignore", ResourceWarning)
pass
def test_main_menu(self):
routing.run([routing.url_for(addon.show_main_menu), '0', ''])
def test_channels_menu(self):
routing.run([routing.url_for(addon.show_channels), '0', ''])
routing.run([routing.url_for(addon.show_channel_menu, channel='vier'), '0', ''])
def test_catalog_menu(self):
routing.run([routing.url_for(addon.show_catalog), '0', ''])
def test_catalog_channel_menu(self):
routing.run([routing.url_for(addon.show_catalog_channel, channel='vier'), '0', ''])
def test_catalog_program_menu(self):
routing.run([routing.url_for(addon.show_catalog_program, channel='vier', program='de-mol'), '0', ''])
def test_catalog_program_season_menu(self):
routing.run([routing.url_for(addon.show_catalog_program_season, channel='vier', program='de-mol', season=-1), '0', ''])
def test_search_menu(self):
routing.run([routing.url_for(addon.show_search), '0', ''])
routing.run([routing.url_for(addon.show_search, query='de mol'), '0', ''])
def test_tvguide_menu(self):
routing.run([routing.url_for(addon.show_tvguide_channel, channel='vier'), '0', ''])
routing.run([routing.url_for(addon.show_tvguide_detail, channel='vier', date='today'), '0', ''])
def test_metadata_update(self):
routing.run([routing.url_for(addon.metadata_clean), '0', ''])
if __name__ == '__main__':
unittest.main()