def update_version(self): version = VersionManager.get() return self.request({ "method": "PATCH", "path": "/" + self.identity.uuid, "json": {"coreVersion": version.get("coreVersion"), "enclosureVersion": version.get("enclosureVersion")} })
def test_version_manager_get_no_file(self, mock_exists): """Test mycroft.version.VersionManager.get() Asserts that the method returns current version if no file exists. """ mock_exists.return_value = False version = VersionManager.get() self.assertEqual(version['coreVersion'], CORE_VERSION_STR) self.assertEqual(version['enclosureVersion'], None)
def activate(self, state, token): version = VersionManager.get() return self.request({ "method": "POST", "path": "/activate", "json": {"state": state, "token": token, "coreVersion": version.get("coreVersion"), "enclosureVersion": version.get("enclosureVersion")} })
def test_version_manager_get(self, mock_exists, mock_isfile): """Test mycroft.version.VersionManager.get() Asserts that the method returns data from version file """ mock_isfile.return_value = True mock_exists.return_value = True version = VersionManager.get() self.assertEqual(version['coreVersion'], "1505203453") self.assertEqual(version['enclosureVersion'], "1.0.0")
def update_version(self): version = VersionManager.get() platform = "unknown" platform_build = "" # load just the local configs to get platform info config = Configuration.get(cache=False, remote=False) if "enclosure" in config: platform = config.get("enclosure").get("platform", "unknown") platform_build = config.get("enclosure").get("platform_build", "") return self.request({ "method": "PATCH", "path": "/" + UUID, "json": {"coreVersion": version.get("coreVersion"), "platform": platform, "platform_build": platform_build, "enclosureVersion": version.get("enclosureVersion")} })
def update_version(self): version = VersionManager.get() platform = "unknown" platform_build = "" # load just the local configs to get platform info config = Configuration.get([SYSTEM_CONFIG, USER_CONFIG], cache=False) if "enclosure" in config: platform = config.get("enclosure").get("platform", "unknown") platform_build = config.get("enclosure").get("platform_build", "") return self.request({ "method": "PATCH", "path": "/" + self.identity.uuid, "json": {"coreVersion": version.get("coreVersion"), "platform": platform, "platform_build": platform_build, "enclosureVersion": version.get("enclosureVersion")} })
def activate(self, state, token): version = VersionManager.get() platform = "unknown" platform_build = "" # load just the local configs to get platform info config = Configuration.get(cache=False, remote=False) if "enclosure" in config: platform = config.get("enclosure").get("platform", "unknown") platform_build = config.get("enclosure").get("platform_build", "") return self.request({ "method": "POST", "path": "/activate", "json": {"state": state, "token": token, "coreVersion": version.get("coreVersion"), "platform": platform, "platform_build": platform_build, "enclosureVersion": version.get("enclosureVersion")} })
def activate(self, state, token): version = VersionManager.get() platform = "unknown" platform_build = "" # load just the local configs to get platform info config = Configuration.get([SYSTEM_CONFIG, USER_CONFIG], cache=False) if "enclosure" in config: platform = config.get("enclosure").get("platform", "unknown") platform_build = config.get("enclosure").get("platform_build", "") return self.request({ "method": "POST", "path": "/activate", "json": {"state": state, "token": token, "coreVersion": version.get("coreVersion"), "platform": platform, "platform_build": platform_build, "enclosureVersion": version.get("enclosureVersion")} })