def test_missing_version(self, shared_datadir, json_data): data = update_data.copy() data['update_folder'] = str(shared_datadir) data['json_data'] = json_data data['latest_version'] = '0.0.4.2.0' p = Patcher(**data) assert p.start() is False
def test_execution(self, shared_datadir, json_data): data = update_data.copy() data["update_folder"] = str(shared_datadir) data["json_data"] = json_data data["channel"] = "stable" p = Patcher(**data) assert p.start() is True
def test_bad_hash_current_version(self, shared_datadir, json_data): data = update_data.copy() data['update_folder'] = str(shared_datadir) data['json_data'] = json_data data['current_file_hash'] = 'Thisisabadhash' p = Patcher(**data) assert p.start() is False
def _patch_update(self, name, version): # pragma: no cover log.info('Starting patch update') filename = get_filename(name, version, self.platform, self.easy_data) log.debug('Archive filename: %s', filename) if filename is None: log.warning('Make sure version numbers are correct. ' 'Possible TRAP!') return False latest = get_highest_version(name, self.platform, self.channel, self.easy_data) # Just checking to see if the zip for the current version is # available to patch If not we'll just do a full binary download if not os.path.exists(os.path.join(self.update_folder, filename)): log.warning( '%s got deleted. No base binary to start patching ' 'form', filename) return False # Initilize Patch object with all required information p = Patcher(name=name, json_data=self.json_data, current_version=version, latest_version=latest, update_folder=self.update_folder, update_urls=self.update_urls, verify=self.verify, progress_hooks=self.progress_hooks) # Returns True if everything went well # If False is returned then we will just do the full # update. return p.start()
def test_no_base_binary(self, json_data): assert os.listdir(os.getcwd()) == [] data = update_data.copy() data["update_folder"] = os.getcwd() data["json_data"] = json_data p = Patcher(**data) assert p.start() is False
def test_bad_hash_current_version(self, shared_datadir, json_data): data = update_data.copy() data["update_folder"] = str(shared_datadir) data["json_data"] = json_data data["current_file_hash"] = "Thisisabadhash" p = Patcher(**data) assert p.start() is False
def test_missing_version(self, shared_datadir, json_data): data = update_data.copy() data["update_folder"] = str(shared_datadir) data["json_data"] = json_data data["latest_version"] = "0.0.4.2.0" p = Patcher(**data) assert p.start() is False
def _patch_update(self): # pragma: no cover log.debug('Starting patch update') # The current version is not in the version manifest if self.current_archive_filename is None: return False # Just checking to see if the zip for the current version is # available to patch If not we'll fall back to a full binary download if not os.path.exists(os.path.join(self.update_folder, self.current_archive_filename)): log.debug('%s got deleted. No base binary to start patching ' 'form', self.current_archive_filename) return False # Initilize Patch object with all required information p = Patcher(name=self.name, json_data=self.json_data, current_version=self.current_version, latest_version=self.latest, update_folder=self.update_folder, update_urls=self.update_urls, verify=self.verify, progress_hooks=self.progress_hooks) # Returns True if everything went well # If False, fall back to a full update return p.start()
def _patch_update(self, name, version): # pragma: no cover log.debug('Starting patch update') filename = get_filename(name, version, self.platform, self.easy_data) log.debug('Archive filename: %s', filename) if filename is None: log.debug('Make sure version numbers are correct. ' 'Possible TRAP!') return False latest = get_highest_version(name, self.platform, self.channel, self.easy_data) # Just checking to see if the zip for the current version is # available to patch If not we'll just do a full binary download if not os.path.exists(os.path.join(self.update_folder, filename)): log.debug('%s got deleted. No base binary to start patching ' 'form', filename) return False # Initilize Patch object with all required information p = Patcher(name=name, json_data=self.json_data, current_version=version, latest_version=latest, update_folder=self.update_folder, update_urls=self.update_urls, verify=self.verify, progress_hooks=self.progress_hooks) # Returns True if everything went well # If False is returned then we will just do the full # update. return p.start()
def _patch_update(self): # pragma: no cover log.debug("Starting patch update") # The current version is not in the version manifest if self._current_archive_name is None: return False # Just checking to see if the zip for the current version is # available to patch If not we'll fall back to a full binary download if not os.path.exists( os.path.join(self.update_folder, self._current_archive_name) ): log.debug( "%s got deleted. No base binary to start patching " "form", self._current_archive_name, ) return False # Initialize Patch object with all required information p = Patcher( current_version=self.current_version, latest_version=self.latest, update_folder=self.update_folder, **self.init_data ) # Returns True if everything went well # If False, fall back to a full update try: rv = p.start() except Exception as err: log.debug(err, exc_info=True) rv = False return rv
def test_execution(self, datadir, json_data): # pytest-datadir copies the file on access datadir[self.base_binary] data = update_data.copy() data['update_folder'] = datadir.tmpdir data['json_data'] = json_data p = Patcher(**data) assert p.start() is True
def test_missing_version(self, datadir, json_data): # pytest-datadir copies the file on access datadir[self.base_binary] data = update_data.copy() data['update_folder'] = datadir.tmpdir data['json_data'] = json_data data['latest_version'] = '0.0.4.2.0' p = Patcher(**data) assert p.start() is False
def test_bad_hash_current_version(self, datadir, json_data): # pytest-datadir copies the file on access datadir[self.base_binary] data = update_data.copy() data['update_folder'] = datadir.tmpdir data['json_data'] = json_data data['current_file_hash'] = 'Thisisabadhash' p = Patcher(**data) assert p.start() is False
def test_execution_callback(self, setup): def cb(status): assert 'downloaded' in status.keys() assert 'total' in status.keys() assert 'status' in status.keys() assert 'percent_complete' in status.keys() data = update_data.copy() data['update_folder'] = setup data['progress_hooks'] = [cb] p = Patcher(**data) assert p.start() is True
def test_execution_callback(self, shared_datadir, json_data): def cb(status): assert 'downloaded' in status.keys() assert 'total' in status.keys() assert 'status' in status.keys() assert 'percent_complete' in status.keys() data = update_data.copy() data['update_folder'] = str(shared_datadir) data['json_data'] = json_data data['progress_hooks'] = [cb] p = Patcher(**data) assert p.start() is True
def test_execution_callback(self, shared_datadir, json_data): def cb(status): assert "downloaded" in status.keys() assert "total" in status.keys() assert "status" in status.keys() assert "percent_complete" in status.keys() data = update_data.copy() data["update_folder"] = str(shared_datadir) data["json_data"] = json_data data["channel"] = "stable" data["progress_hooks"] = [cb] p = Patcher(**data) assert p.start() is True
def test_execution_callback(self, datadir, json_data): def cb(status): assert 'downloaded' in status.keys() assert 'total' in status.keys() assert 'status' in status.keys() assert 'percent_complete' in status.keys() # pytest-datadir copies the file on access datadir[self.base_binary] data = update_data.copy() data['update_folder'] = datadir.tmpdir data['json_data'] = json_data data['progress_hooks'] = [cb] p = Patcher(**data) assert p.start() is True
def test_execution(self, shared_datadir, json_data): data = update_data.copy() data['update_folder'] = str(shared_datadir) data['json_data'] = json_data p = Patcher(**data) assert p.start() is True
def test_missing_version(self, setup): data = update_data.copy() data['update_folder'] = setup data['highest_version'] = '0.0.4' p = Patcher(**data) assert p.start() is False
def test_bad_hash_current_version(self, setup): data = update_data.copy() data['update_folder'] = setup data['current_file_hash'] = 'Thisisabadhash' p = Patcher(**data) assert p.start() is False
def test_execution(self, setup): data = update_data.copy() data['update_folder'] = setup p = Patcher(**data) assert p.start() is True
def test_no_base_binary(self): assert os.listdir(os.getcwd()) == [] data = update_data.copy() data['update_folder'] = os.getcwd() p = Patcher(**data) assert p.start() is False
def test_missing_version(self, setup): data = update_data.copy() data['update_folder'] = setup data['latest_version'] = '0.0.4.2.0' p = Patcher(**data) assert p.start() is False