def test1(self): data = EasyAccessDict(self.version_data) assert get_highest_version('Acme', 'mac', 'alpha', data, strict=True) == '4.4.2.0.5' assert get_highest_version('Acme', 'mac', 'beta', data, strict=True) == '4.4.1.1.0' assert get_highest_version('Acme', 'mac', 'stable', data, strict=True) == '4.4.3.2.0'
def test1(self): data = EasyAccessDict(self.version_data) assert (get_highest_version("Acme", "mac", "alpha", data, strict=True) == "4.4.2.0.5") assert (get_highest_version("Acme", "mac", "beta", data, strict=True) == "4.4.1.1.0") assert (get_highest_version("Acme", "mac", "stable", data, strict=True) == "4.4.3.2.0")
def _update_check(self, name, version, channel, strict): valid_channels = ["alpha", "beta", "stable"] if channel not in valid_channels: log.debug("Invalid channel. May need to check spelling") channel = "stable" self.name = name # Version object used for comparison version = _Version(version) self.version = str(version) # Will be set to true if we are updating the currently # running app and not an app's asset app = False if self.ready is False: # No json data is loaded. # User may need to call refresh log.debug("No update manifest found") return None # Checking if version file is verified before # processing data contained in the version file. # This was done by self._get_update_manifest if self.verified is False: log.debug("Failed version file verification") return None # If we are an app we will need restart functionality, so we'll # user AppUpdate instead of LibUpdate if self.FROZEN is True and self.name == self.app_name: app = True log.debug("Checking for %s updates...", name) latest = get_highest_version( name, self.platform, channel, self.easy_data, strict ) if latest is None: # If None is returned get_highest_version could # not find the supplied name in the version file log.debug("Could not find the latest version") return None # Change str to version object for easy comparison latest = _Version(latest) log.debug("Current version: %s", str(version)) log.debug("Latest version: %s", str(latest)) update_needed = latest > version log.debug("Update Needed: %s", update_needed) if latest <= version: log.debug("%s already updated to the latest version", name) return None # Config data to initialize update object data = { "strict": strict, "update_urls": self.update_urls, "name": self.name, "version": self.version, "easy_data": self.easy_data, "json_data": self.json_data, "data_dir": self.data_dir, "platform": self.platform, "channel": channel, "app_name": self.app_name, "verify": self.verify, "max_download_retries": self.max_download_retries, "progress_hooks": list(set(self.progress_hooks)), "urllib3_headers": self.urllib3_headers, "downloader": self.downloader, } data.update(self._gen_file_downloader_options()) # Return update object with which handles downloading, # extracting updates if app is True: # AppUpdate is a subclass of LibUpdate that add methods # to restart the application return AppUpdate(data) else: return LibUpdate(data)
def test1(self): data = EasyAccessDict(self.version_data) assert get_highest_version('Acme', 'mac', 'stable', data, strict=True) is None
def test1(self): data = EasyAccessDict(self.version_data) assert get_highest_version('Acme', 'mac', 'alpha', data, strict=False) == '4.4.3.2.0'
def test1(self): data = EasyAccessDict(self.version_data) assert get_highest_version("Acme", "mac", "stable", data, strict=True) is None
def test1(self): data = EasyAccessDict(self.version_data) assert (get_highest_version("Acme", "mac", "alpha", data, strict=False) == "4.4.3.2.0")
def _update_check(self, name, version, channel, strict): valid_channels = ['alpha', 'beta', 'stable'] if channel not in valid_channels: log.debug('Invalid channel. May need to check spelling') channel = 'stable' self.name = name # Version object used for comparison version = _Version(version) self.version = str(version) # Will be set to true if we are updating the currently # running app and not an app's asset app = False if self.ready is False: # No json data is loaded. # User may need to call refresh log.debug('No update manifest found') return None # Checking if version file is verified before # processing data contained in the version file. # This was done by self._get_update_manifest if self.verified is False: log.debug('Failed version file verification') return None # If we are an app we will need restart functionality, so we'll # user AppUpdate instead of LibUpdate if self.FROZEN is True and self.name == self.app_name: app = True log.debug('Checking for %s updates...', name) latest = get_highest_version(name, self.platform, channel, self.easy_data, strict) if latest is None: # If None is returned get_highest_version could # not find the supplied name in the version file log.debug('Could not find the latest version') return None # Change str to version object for easy comparison latest = _Version(latest) log.debug('Current version: %s', str(version)) log.debug('Latest version: %s', str(latest)) update_needed = latest > version log.debug('Update Needed: %s', update_needed) if latest <= version: log.debug('%s already updated to the latest version', name) return None # Config data to initialize update object data = { 'strict': strict, 'update_urls': self.update_urls, 'name': self.name, 'version': self.version, 'easy_data': self.easy_data, 'json_data': self.json_data, 'data_dir': self.data_dir, 'platform': self.platform, 'channel': channel, 'app_name': self.app_name, 'verify': self.verify, 'max_download_retries': self.max_download_retries, 'progress_hooks': list(set(self.progress_hooks)), 'urllib3_headers': self.urllib3_headers, } # Return update object with which handles downloading, # extracting updates if app is True: # AppUpdate is a subclass of LibUpdate that add methods # to restart the application return AppUpdate(data) else: return LibUpdate(data)