def test_get_login_link(self): """ADD ME""" constants = Constants() self.assertEqual( first=constants.get_login_link(), second= 'https://www.telekomsport.de/service/auth/web/login?headto=https://www.telekomsport.de/info' )
def test_get_stream_definition_url(self): """ADD ME""" base = 'https://www.telekomsport.de' route = '/service/player/streamAccess' params = '?videoId=%VIDEO_ID%&label=2780_hls' constants = Constants() self.assertEqual(first=constants.get_stream_definition_url(), second=base + route + params)
def test_get_sports_list(self): """ADD ME""" constants = Constants() sports = constants.get_sports_list() sports_keys = sports.keys() self.assertIn('liga3', sports_keys) self.assertIn('del', sports_keys) self.assertIn('ffb', sports_keys) self.assertIn('fcb', sports_keys) self.assertIn('bbl', sports_keys) self.assertIn('bel', sports_keys) self.assertIn('skybuli', sports_keys) self.assertIn('skychamp', sports_keys) self.assertIn('skyhandball', sports_keys)
def test_get_user_agent_Windows(self, mock_system): """ADD ME""" mock_system.return_value = 'Windows' utils = Utils(kodi_base_url='/foo/', constants=Constants()) self.assertIn( container=utils.get_user_agent(), member='Win')
def test_get_use_inputstream_high_inputstream(self, mock_executeJSONRPC, mock_executeJSONRPC2): mock_executeJSONRPC.return_value = '{"result": {"version": {"major": 18}}}' mock_executeJSONRPC2.return_value = '{"result": {"addon": {"enabled": true, "version": "12.1.7"}}}' utils = Utils(kodi_base_url='/foo/', constants=Constants()) self.assertEquals( first=utils.use_inputstream(), second=False)
def test_get_use_inputstream_low_inputstream(self, mock_executeJSONRPC): mock_executeJSONRPC.return_value = '{"result": {"version": {"major": 18}}}' utils = Utils(kodi_base_url='/foo/', constants=Constants()) def return_low_version(): return '0.9.9' utils.get_inputstream_version = return_low_version self.assertEquals( first=utils.use_inputstream(), second=False)
def test_capitalize(self): """ADD ME""" utils = Utils(kodi_base_url='/foo/', constants=Constants()) self.assertEquals( first=utils.capitalize('foo bar'), second='Foo Bar') self.assertEquals( first=utils.capitalize('FOO BAR'), second='Foo Bar') self.assertEquals( first=utils.capitalize('Foo Bar'), second='Foo Bar')
def test_get_localized_string_unicode(self, mock_xbmcaddon): mock_xbmcaddon.return_value = MockAddon() utils = Utils(kodi_base_url='/foo/', constants=Constants()) self.assertEquals( first=utils.get_local_string(30001), second='Foo')
def test_get_use_inputstream_setting_off(self, mock_xbmcaddon): mock_xbmcaddon.return_value = MockAddon() utils = Utils(kodi_base_url='/foo/', constants=Constants()) self.assertEquals( first=utils.use_inputstream(), second=False)
def test_get_inputstream_version_no_version(self, mock_executeJSONRPC): mock_executeJSONRPC.return_value = '{"result": {"addon": {"enabled": true}}}' utils = Utils(kodi_base_url='/foo/', constants=Constants()) self.assertEquals( first=utils.get_inputstream_version(), second='1.0.0')
def test_get_addon(self): """ADD ME""" utils = Utils(kodi_base_url='/foo/', constants=Constants()) self.assertIn( container=str(utils.get_addon()), member='xbmcaddon.Addon')
def test_get_kodi_version_error_response(self, mock_executeJSONRPC): mock_executeJSONRPC.return_value = '{"error": true}' utils = Utils(kodi_base_url='/foo/', constants=Constants()) self.assertEquals( first=utils.get_kodi_version(), second=17)
def test_get_kodi_version_local_version(self, mock_executeJSONRPC): mock_executeJSONRPC.return_value = '{"result": {"version": {"major": 18}}}' utils = Utils(kodi_base_url='/foo/', constants=Constants()) self.assertEquals( first=utils.get_kodi_version(), second=18)
def test_get_statics_list(self): """ADD ME""" constants = Constants() statics = constants.get_statics_list() statics_keys = statics.keys() self.assertIn('liga3', statics_keys)
def test_get_epg_url(self): """ADD ME""" constants = Constants() self.assertEqual(first=constants.get_epg_url(), second='https://www.telekomsport.de/api/v1/')
def test_get_login_endpoint(self): """ADD ME""" constants = Constants() self.assertEqual(first=constants.get_login_endpoint(), second='https://accounts.login.idm.telekom.com/sso')
def test_generate_hash(self): """ADD ME""" utils = Utils(kodi_base_url='/foo/', constants=Constants()) self.assertEquals( first=utils.generate_hash('ABCDEFG'), second='bae3735e5822d8c30fafd70736316e7807f7cccf65e6e73c15f32a60')
def test_get_use_inputstream_error(self, mock_executeJSONRPC): mock_executeJSONRPC.return_value = '{"error": true}' utils = Utils(kodi_base_url='/foo/', constants=Constants()) self.assertEquals( first=utils.use_inputstream(), second=False)
def test_build_url(self): """ADD ME""" utils = Utils(kodi_base_url='/foo/', constants=Constants()) self.assertIn( container=utils.build_url({'bar': 'baz'}), member='/foo/?bar=baz')
def test_get_user_agent(self): """ADD ME""" utils = Utils(kodi_base_url='/foo/', constants=Constants()) self.assertIn( container=utils.get_user_agent(), member='Chrome/59.0.3071.115')
# setup plugin base stuff try: PLUGIN_HANDLE = int(argv[1]) KODI_BASE_URL = argv[0] except ValueError: PLUGIN_HANDLE = 1 KODI_BASE_URL = '' try: from urllib.parse import parse_qsl except: from urlparse import parse_qsl # init plugin object structure CONSTANTS = Constants() CACHE = Cache() UTILS = Utils(constants=CONSTANTS, kodi_base_url=KODI_BASE_URL) DIALOGS = Dialogs(utils=UTILS) ITEM_HELPER = ItemHelper(constants=CONSTANTS, utils=UTILS) SETTINGS = Settings(utils=UTILS, dialogs=DIALOGS, constants=CONSTANTS) SESSION = Session(constants=CONSTANTS, util=UTILS, settings=SETTINGS) CONTENT_LOADER = ContentLoader( session=SESSION, item_helper=ITEM_HELPER, cache=CACHE, handle=PLUGIN_HANDLE) def router(paramstring): """
def test_get_addon_id(self): """ADD ME""" constants = Constants() self.assertEqual(first=constants.get_addon_id(), second='plugin.video.telekom-sport')