def setUp(self): """Prepare the test fixture.""" super(ReinstallCommandTest, self).setUp() base = support.BaseCliStub('main') base.init_sack() self._cmd = dnf.cli.commands.reinstall.ReinstallCommand( base.mock_cli())
def test_info(self): self.cmd = dnf.cli.commands.repoquery.RepoQueryCommand( support.CliStub(support.BaseCliStub())) support.command_configure(self.cmd, ['--source']) pkg = dnf.cli.commands.repoquery.PackageWrapper(PkgStub()) self.assertEqual(self.cmd.build_format_fn(self.cmd.opts, pkg), EXPECTED_SOURCERPM_FORMAT)
def setUp(self): """Prepare the test fixture.""" super(RepoPkgsInfoSubCommandTest, self).setUp() base = support.BaseCliStub('main', 'updates', 'third_party') base.conf.recent = 7 self._cmd = dnf.cli.commands.RepoPkgsCommand.InfoSubCommand( base.mock_cli())
def setUp(self): """Prepare the test fixture.""" super(InstallCommandTest, self).setUp() base = support.BaseCliStub('main') base.repos['main'].metadata = mock.Mock(comps_fn=support.COMPS_PATH) base.init_sack() self._cmd = dnf.cli.commands.install.InstallCommand(base.mock_cli())
def setUp(self): """Prepare the test fixture.""" super(RepoPkgsUpgradeToSubCommandTest, self).setUp() base = support.BaseCliStub('updates', 'third_party') base.init_sack() self.cmd = dnf.cli.commands.RepoPkgsCommand.UpgradeToSubCommand( base.mock_cli())
def setUp(self): """Prepare the test fixture.""" super(RepoPkgsRemoveSubCommandTest, self).setUp() base = support.BaseCliStub('main') base.init_sack() self.cmd = dnf.cli.commands.RepoPkgsCommand.RemoveSubCommand( base.mock_cli())
def test_filelist(self): self.cmd = dnf.cli.commands.repoquery.RepoQueryCommand( support.CliStub(support.BaseCliStub())) support.command_configure(self.cmd, ['-l']) pkg = dnf.cli.commands.repoquery.PackageWrapper(PkgStub()) self.assertEqual(self.cmd.build_format_fn(self.cmd.opts, pkg), EXPECTED_FILELIST_FORMAT)
def setUp(self): """Prepare the test fixture.""" super(RepoPkgsInstallSubCommandTest, self).setUp() base = support.BaseCliStub('main', 'third_party') base.repos['main'].metadata = mock.Mock(comps_fn=support.COMPS_PATH) base.repos['third_party'].enablegroups = False base.init_sack() self.cli = base.mock_cli()
def test_parse_args(self): cli = support.CliStub(support.BaseCliStub()) cli.base.repos.add(dnf.repo.Repo(name='silver')) cli.base.repos.add(dnf.repo.Repo(name='screen')) cmd = reposync.RepoSyncCommand(cli) args = '-p /become/legend --repo=silver --repo=screen'.split() support.command_configure(cmd, args) self.assertEqual(cmd.opts.repo, ['silver', 'screen']) self.assertEqual(cmd.opts.download_path, '/become/legend')
def test_canonical(self): cmd = dnf.cli.commands.upgrade.UpgradeCommand( support.BaseCliStub('main').mock_cli()) try: support.command_run(cmd, ['cracker', 'filling']) except dnf.exceptions.Error as e: if e.value != 'No packages marked for upgrade.': raise self.assertEqual(cmd._basecmd, 'upgrade') self.assertEqual(cmd.opts.pkg_specs, ['cracker', 'filling'])
def test_obsoleted(self): self.cmd = dnf.cli.commands.check.CheckCommand( support.CliStub(support.BaseCliStub())) support.command_configure(self.cmd, ['--obsoleted']) with support.patch_std_streams() as (stdout, _): with self.assertRaises(dnf.exceptions.Error) as ctx: self.cmd.run() self.assertEqual(str(ctx.exception), 'Check discovered 1 problem(s)') self.assertEqual(stdout.getvalue(), EXPECTED_OBSOLETED_FORMAT)
def setUp(self): """Prepare the test fixture.""" super(_KickstartCommandFixture, self).setUp() base = support.BaseCliStub(self.AVAILABLE_PACKAGES, self.AVAILABLE_GROUPS) cli = support.CliStub(base) self._command = kickstart.KickstartCommand(cli) cli.register_command(self._command) base.read_all_repos() base.basecmd = self._command.aliases[0]
def setUp(self): """Prepare the test fixture.""" super(RepoPkgsReinstallSubCommandTest, self).setUp() self.cli = support.BaseCliStub('main').mock_cli() self.mock = mock.Mock() old_run_patcher = mock.patch( 'dnf.cli.commands.RepoPkgsCommand.ReinstallOldSubCommand.run_on_repo', self.mock.reinstall_old_run) move_run_patcher = mock.patch( 'dnf.cli.commands.RepoPkgsCommand.MoveToSubCommand.run_on_repo', self.mock.move_to_run) old_run_patcher.start() self.addCleanup(old_run_patcher.stop) move_run_patcher.start() self.addCleanup(move_run_patcher.stop)
def setUp(self): """Prepare the test fixture.""" super(RepoPkgsRemoveOrReinstallSubCommandTest, self).setUp() base = support.BaseCliStub('distro') base.init_sack() self.cli = base.mock_cli()
def setUp(self): """Prepare the test fixture.""" super(RepoPkgsRemoveOrDistroSyncSubCommandTest, self).setUp() self.cli = support.BaseCliStub('distro').mock_cli() self.cli.base.init_sack()
def setUp(self): """Prepare the test fixture.""" super(RepoPkgsMoveToSubCommandTest, self).setUp() base = support.BaseCliStub('distro', 'main') base.init_sack() self.cli = base.mock_cli()
def setUp(self): self._base = support.BaseCliStub() self._base._sack = support.mock_sack('main', 'updates') self._base._goal = dnf.goal.Goal(self._base.sack)
def setUp(self): """Prepare the test fixture.""" super(RepoPkgsCheckUpdateSubCommandTest, self).setUp() base = support.BaseCliStub('main', 'updates', 'third_party') self.cli = base.mock_cli()
def setUp(self): cli = support.CliStub(support.BaseCliStub()) self.cmd = reposync.RepoSyncCommand(cli)
def setUp(self): """Prepare the test fixture.""" super(UpgradeCommandTest, self).setUp() base = support.BaseCliStub('updates') base.init_sack() self.cmd = dnf.cli.commands.upgrade.UpgradeCommand(base.mock_cli())
def setUp(self): self.cmd = dnf.cli.commands.repoquery.RepoQueryCommand( support.CliStub(support.BaseCliStub()))
def setUp(self): self._base = support.BaseCliStub() self._base._sack = support.mock_sack('main', 'updates') self._base._goal = dnf.goal.Goal(self._base.sack) self._base.logger = mock.create_autospec(self._base.logger)
def setUp(self): """Prepare the test fixture.""" super(RepoPkgsCheckUpdateSubCommandTest, self).setUp() cli = support.BaseCliStub('main', 'updates', 'third_party').mock_cli() self._cmd = dnf.cli.commands.RepoPkgsCommand.CheckUpdateSubCommand(cli) self.cli = cli
def setUp(self): """Prepare the test fixture.""" super(RemoveCommandTest, self).setUp() base = support.BaseCliStub() base.init_sack() self.cmd = dnf.cli.commands.remove.RemoveCommand(base.mock_cli())
def setUp(self): """Prepare the test fixture.""" super(RepoPkgsCommandTest, self).setUp() cli = support.BaseCliStub().mock_cli() self.cmd = dnf.cli.commands.RepoPkgsCommand(cli)