Beispiel #1
0
 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())
Beispiel #2
0
 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)
Beispiel #3
0
 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())
Beispiel #4
0
 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())
Beispiel #5
0
 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())
Beispiel #6
0
 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())
Beispiel #7
0
 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)
Beispiel #8
0
 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')
Beispiel #10
0
 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'])
Beispiel #11
0
 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]
Beispiel #13
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)
Beispiel #14
0
 def setUp(self):
     """Prepare the test fixture."""
     super(RepoPkgsRemoveOrReinstallSubCommandTest, self).setUp()
     base = support.BaseCliStub('distro')
     base.init_sack()
     self.cli = base.mock_cli()
Beispiel #15
0
 def setUp(self):
     """Prepare the test fixture."""
     super(RepoPkgsRemoveOrDistroSyncSubCommandTest, self).setUp()
     self.cli = support.BaseCliStub('distro').mock_cli()
     self.cli.base.init_sack()
Beispiel #16
0
 def setUp(self):
     """Prepare the test fixture."""
     super(RepoPkgsMoveToSubCommandTest, self).setUp()
     base = support.BaseCliStub('distro', 'main')
     base.init_sack()
     self.cli = base.mock_cli()
Beispiel #17
0
 def setUp(self):
     self._base = support.BaseCliStub()
     self._base._sack = support.mock_sack('main', 'updates')
     self._base._goal = dnf.goal.Goal(self._base.sack)
Beispiel #18
0
 def setUp(self):
     """Prepare the test fixture."""
     super(RepoPkgsCheckUpdateSubCommandTest, self).setUp()
     base = support.BaseCliStub('main', 'updates', 'third_party')
     self.cli = base.mock_cli()
Beispiel #19
0
 def setUp(self):
     cli = support.CliStub(support.BaseCliStub())
     self.cmd = reposync.RepoSyncCommand(cli)
Beispiel #20
0
 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())
Beispiel #21
0
 def setUp(self):
     self.cmd = dnf.cli.commands.repoquery.RepoQueryCommand(
         support.CliStub(support.BaseCliStub()))
Beispiel #22
0
 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)
Beispiel #23
0
 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
Beispiel #24
0
 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())
Beispiel #25
0
 def setUp(self):
     """Prepare the test fixture."""
     super(RepoPkgsCommandTest, self).setUp()
     cli = support.BaseCliStub().mock_cli()
     self.cmd = dnf.cli.commands.RepoPkgsCommand(cli)