def test_reset_packages_conflict(self, mocker): self.patch(mocker) assert release.RETCODE_EINVAL == release.route(args=self.make_args( reset_packages=True, reset_url=True), argv=['test', '-p']) assert release.RETCODE_EINVAL == release.route(args=self.make_args( reset_packages=True, target_release='new_release'), argv=['test', '-p']) assert release.RETCODE_EINVAL == release.route(args=self.make_args( reset_packages=True, prefix='new/prefix'), argv=['test', '-p'])
def test_new_state_not_exist(self, mocker): state = release.SystemState('testing', 'wb6/stretch', '', True) new_state = release.SystemState('stable', 'wb6/stretch', '', True) self.patch(mocker, state, release_exists=False) assert release.RETCODE_NO_TARGET == release.route( args=self.make_args(target_release='stable'), argv=['test', '-t']) release.release_exists.assert_called_once_with(new_state) release.update_system.assert_not_called()
def test_reset_packages_route(self, mocker): state = release.SystemState('testing', 'wb6/stretch', '', True) self.patch(mocker, state) assert release.RETCODE_OK == release.route( args=self.make_args(reset_packages=True), argv=['test', '-p']) release.update_system.assert_called_once_with(state, state, second_stage=True, assume_yes=False, log_filename=None)
def test_old_state_inconsistent(self, mocker): state = release.SystemState('testing', 'wb6/stretch', '', False) new_state = release.SystemState('testing', 'wb6/stretch', '', True) self.patch(mocker, state) assert release.RETCODE_OK == release.route( args=self.make_args(target_release='testing'), argv=['test', '-t']) release.release_exists.assert_called_once_with(new_state) release.update_system.assert_called_once_with(new_state, state, second_stage=False, assume_yes=False, log_filename=None)
def test_same_state(self, mocker): state = release.SystemState('testing', 'wb6/stretch', '', True) self.patch(mocker, state) assert release.RETCODE_OK == release.route( args=self.make_args(target_release='testing'), argv=['test', '-t'])
def test_regenerate_config(self, mocker): state = release.SystemState('testing', 'wb6/stretch', '', True) self.patch(mocker, state) assert release.RETCODE_OK == release.route( args=self.make_args(regenerate=True), argv=['test', '-r']) release.generate_system_config.assert_called_once_with(state)
def test_print_banner_version(self, mocker): self.patch(mocker) assert release.RETCODE_OK == release.route( args=self.make_args(version=True), argv=['test', '-v']) release.print_banner.assert_called_once_with()
def test_print_banner_empty(self, mocker): self.patch(mocker) assert release.RETCODE_OK == release.route(args=self.make_args(), argv=['test']) release.print_banner.assert_called_once_with()