def setUp(self): self.api = ApiV2(settings=Settings(MagicMock()), lang="en", cache=MagicMock()) self.api.settings.get = self._side_effect_settings_get
import os import sys import urllib.parse import xbmc import xbmcaddon import xbmcgui import xbmcplugin import xbmcvfs addon = xbmcaddon.Addon() addon_id = addon.getAddonInfo("id") addon_base = "plugin://" + addon_id addon_profile_path = xbmcvfs.translatePath(addon.getAddonInfo("profile")) vfs = VFS(addon_profile_path) vfs_cache = VFS(os.path.join(addon_profile_path, "cache")) settings = Settings(addon) cache = Cache(settings, vfs_cache) api = ApiV2(settings, xbmc.getLanguage(xbmc.ISO_639_1), cache) search_history = SearchHistory(settings, vfs) listItems = Items(addon, addon_base, search_history) def run(): url = urllib.parse.urlparse(sys.argv[0]) path = url.path handle = int(sys.argv[1]) args = urllib.parse.parse_qs(sys.argv[2][1:]) xbmcplugin.setContent(handle, "songs") if path == PATH_ROOT: action = args.get("action", None)
def setUp(self): self.api = Api(Settings(MagicMock()), "en", MagicMock(), MagicMock()) self.api.api_cdn = "fastly_skyfire" xbmcMock.getUserAgent = Mock(return_value="A User-Agent String")