Пример #1
0
    def test_info_all(self):
        """Test whether only packages related to the repository are listed."""
        for pkg in self._cmd.base.sack.query().installed().filter(
                name='pepper'):
            self._cmd.base.yumdb.db[str(
                pkg)] = support.RPMDBAdditionalDataPackageStub()
            self._cmd.base.yumdb.get_package(pkg).from_repo = 'main'

        with support.patch_std_streams() as (stdout, _):
            self._cmd.run('main', ['all', '*p*'])

        self.assertEqual(
            stdout.getvalue(), ''.join(
                (self.INSTALLED_TITLE, self.PEPPER_SYSTEM_INFO,
                 self.AVAILABLE_TITLE, u'Name        : pepper\n'
                 u'Arch        : src\n'
                 u'Epoch       : 0\n'
                 u'Version     : 20\n'
                 u'Release     : 0\n'
                 u'Size        : 0.0  \n'
                 u'Repo        : main\n'
                 u'Summary     : \n'
                 u'License     : \n'
                 u'Description : \n'
                 u'\n', u'Name        : trampoline\n'
                 u'Arch        : noarch\n'
                 u'Epoch       : 0\n'
                 u'Version     : 2.1\n'
                 u'Release     : 1\n'
                 u'Size        : 0.0  \n'
                 u'Repo        : main\n'
                 u'Summary     : \n'
                 u'License     : \n'
                 u'Description : \n'
                 u'\n')))
Пример #2
0
 def test_setup(self):
     logger = logging.getLogger("dnf")
     with support.patch_std_streams() as (stdout, stderr):
         self.logging._setup(logging.INFO, logging.ERROR, self.logdir)
         self._bench(logger)
     self.assertEqual("i\n", stdout.getvalue())
     self.assertEqual("e\n", stderr.getvalue())
Пример #3
0
 def test_setup_verbose(self):
     logger = logging.getLogger("dnf")
     with support.patch_std_streams() as (stdout, stderr):
         self.logging.setup(logging.DEBUG, logging.WARNING, self.logdir)
         self._bench(logger)
     self.assertEqual("d\ni\n", stdout.getvalue())
     self.assertEqual("w\ne\n", stderr.getvalue())
Пример #4
0
 def test_setup_verbose(self):
     logger = logging.getLogger("dnf")
     with support.patch_std_streams() as (stdout, stderr):
         self.logging._setup(logging.DEBUG, logging.WARNING, self.logdir)
         self._bench(logger)
     self.assertEqual("d\ni\n", stdout.getvalue())
     self.assertEqual("w\ne\n", stderr.getvalue())
Пример #5
0
 def test_setup(self):
     logger = logging.getLogger("dnf")
     with support.patch_std_streams() as (stdout, stderr):
         self.logging.setup(logging.INFO, logging.ERROR, self.logdir)
         self._bench(logger)
     self.assertEqual("i\n", stdout.getvalue())
     self.assertEqual("e\n", stderr.getvalue())
Пример #6
0
 def test_info_upgrades(self):
     """Test whether only upgrades in the repository are listed."""
     cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
     with support.patch_std_streams() as (stdout, _):
         support.command_run(cmd, ['updates', 'info', 'upgrades'])
     self.assertEqual(stdout.getvalue(), ''.join((
         u'Available Upgrades\n', self.HOLE_X86_64_INFO, self.PEPPER_UPDATES_INFO)))
Пример #7
0
 def test_info_upgrades(self):
     """Test whether only upgrades in the repository are listed."""
     cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
     with support.patch_std_streams() as (stdout, _):
         support.command_run(cmd, ['updates', 'info', 'upgrades'])
     self.assertEqual(stdout.getvalue(), ''.join((
         u'Available Upgrades\n', self.HOLE_X86_64_INFO, self.PEPPER_UPDATES_INFO)))
Пример #8
0
    def test(self):
        """Test whether only upgrades in the repository are listed."""
        for pkg in self.cli.base.sack.query().installed().filter(name='tour'):
            self.cli.base._yumdb.db[str(pkg)] = support.RPMDBAdditionalDataPackageStub()
            self.cli.base._yumdb.get_package(pkg).from_repo = 'updates'

        cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            support.command_run(cmd, ['updates', 'check-update'])

        self.assertEqual(
            stdout.getvalue(),
            u'\n'
            u'hole.x86_64                              1-2'
            u'                            updates \n'
            u'hole.x86_64                              2-1'
            u'                            updates \n'
            u'pepper.x86_64                            20-1'
            u'                           updates \n'
            u'Obsoleting Packages\n'
            u'hole.i686                                2-1'
            u'                            updates \n'
            u'    tour.noarch                          5-0'
            u'                            @updates\n'
            u'hole.x86_64                              2-1'
            u'                            updates \n'
            u'    tour.noarch                          5-0'
            u'                            @updates\n')
        self.assertEqual(self.cli.demands.success_exit_status, 100)
Пример #9
0
 def test_configure_badargs(self):
     """Test whether the command fail in case of wrong args."""
     with self.assertRaises(SystemExit) as exit, \
         support.patch_std_streams() as (stdout, stderr), \
         mock.patch('logging.Logger.critical') as clog:
         support.command_configure(self.cmd, [])
     self.assertEqual(exit.exception.code, 1)
Пример #10
0
 def test_configure_badargs(self):
     """Test whether the command fail in case of wrong args."""
     with self.assertRaises(SystemExit) as exit, \
         support.patch_std_streams() as (stdout, stderr), \
         mock.patch('logging.Logger.critical') as clog:
         support.command_configure(self.cmd, [])
     self.assertEqual(exit.exception.code, 1)
Пример #11
0
    def test(self):
        """Test whether only upgrades in the repository are listed."""
        cmd = dnf.cli.commands.RepoPkgsCommand.CheckUpdateSubCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            cmd.run_on_repo('updates', [])

        self.assertEqual(
            stdout.getvalue(),
            u'\n'
            u'hole.x86_64                               1-2'
            u'                            updates\n'
            u'hole.x86_64                               2-1'
            u'                            updates\n'
            u'pepper.x86_64                             20-1'
            u'                           updates\n'
            u'Obsoleting Packages\n'
            u'hole.i686                                 2-1'
            u'                            updates\n'
            u'    tour.noarch                           5-0'
            u'                            @System\n'
            u'hole.x86_64                               2-1'
            u'                            updates\n'
            u'    tour.noarch                           5-0'
            u'                            @System\n')
        self.assertEqual(self.cli.demands.success_exit_status, 100)
Пример #12
0
    def test_info_all(self):
        """Test whether only packages related to the repository are listed."""
        history = self.cli.base.history
        for pkg in self.cli.base.sack.query().installed().filter(
                name='pepper'):
            mockSwdbPkg(history, pkg, repo='main')

        cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            support.command_run(cmd, ['main', 'info', 'all', '*p*'])

        self.assertEqual(
            stdout.getvalue(), ''.join(
                (self.INSTALLED_TITLE, self.PEPPER_SYSTEM_INFO,
                 self.AVAILABLE_TITLE, u'Name         : pepper\n'
                 u'Version      : 20\n'
                 u'Release      : 0\n'
                 u'Arch         : src\n'
                 u'Size         : 0.0  \n'
                 u'Source       : None\n'
                 u'Repo         : main\n'
                 u'Summary      : \n'
                 u'License      : \n'
                 u'Description  : \n'
                 u'\n', u'Name         : trampoline\n'
                 u'Version      : 2.1\n'
                 u'Release      : 1\n'
                 u'Arch         : noarch\n'
                 u'Size         : 0.0  \n'
                 u'Source       : None\n'
                 u'Repo         : main\n'
                 u'Summary      : \n'
                 u'License      : \n'
                 u'Description  : \n'
                 u'\n')))
Пример #13
0
    def test(self, _real_term_width):
        """ Test whether only upgrades in the repository are listed. """
        history = self.cli.base.history
        for pkg in self.cli.base.sack.query().installed().filter(name='tour'):
            mockSwdbPkg(history, pkg, repo='updates')

        cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            support.command_run(cmd, ['updates', 'check-update'])

        self.assertEqual(
            stdout.getvalue(), u'\n'
            u'hole.x86_64                              2-1'
            u'                            updates \n'
            u'pepper.x86_64                            20-1'
            u'                           updates \n'
            u'Obsoleting Packages\n'
            u'hole.i686                                2-1'
            u'                            updates \n'
            u'    tour.noarch                          5-0'
            u'                            @updates\n'
            u'hole.x86_64                              2-1'
            u'                            updates \n'
            u'    tour.noarch                          5-0'
            u'                            @updates\n')
        self.assertEqual(self.cli.demands.success_exit_status, 100)
Пример #14
0
    def test(self):
        """Test whether only upgrades in the repository are listed."""
        for pkg in self.cli.base.sack.query().installed().filter(name='tour'):
            self.cli.base._yumdb.db[str(
                pkg)] = support.RPMDBAdditionalDataPackageStub()
            self.cli.base._yumdb.get_package(pkg).from_repo = 'updates'

        cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            support.command_run(cmd, ['updates', 'check-update'])

        self.assertEqual(
            stdout.getvalue(), u'\n'
            u'hole.x86_64                              1-2'
            u'                            updates \n'
            u'hole.x86_64                              2-1'
            u'                            updates \n'
            u'pepper.x86_64                            20-1'
            u'                           updates \n'
            u'Obsoleting Packages\n'
            u'hole.i686                                2-1'
            u'                            updates \n'
            u'    tour.noarch                          5-0'
            u'                            @updates\n'
            u'hole.x86_64                              2-1'
            u'                            updates \n'
            u'    tour.noarch                          5-0'
            u'                            @updates\n')
        self.assertEqual(self.cli.demands.success_exit_status, 100)
Пример #15
0
    def test(self):
        """ Test whether only upgrades in the repository are listed. """
        history = self.cli.base.history
        for pkg in self.cli.base.sack.query().installed().filter(name='tour'):
            mockSwdbPkg(history, pkg, repo='updates')

        cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            support.command_run(cmd, ['updates', 'check-update'])

        self.assertEqual(
            stdout.getvalue(),
            u'\n'
            u'hole.x86_64                              2-1'
            u'                            updates \n'
            u'pepper.x86_64                            20-1'
            u'                           updates \n'
            u'Obsoleting Packages\n'
            u'hole.i686                                2-1'
            u'                            updates \n'
            u'    tour.noarch                          5-0'
            u'                            @updates\n'
            u'hole.x86_64                              2-1'
            u'                            updates \n'
            u'    tour.noarch                          5-0'
            u'                            @updates\n')
        self.assertEqual(self.cli.demands.success_exit_status, 100)
Пример #16
0
    def test_info_obsoletes(self):
        """Test whether only obsoletes in the repository are listed."""
        with support.patch_std_streams() as (stdout, _):
            self._cmd.run('updates', ['obsoletes'])

        self.assertEqual(
            stdout.getvalue(), ''.join(
                (u'Obsoleting Packages\n', self.HOLE_I686_INFO,
                 self.HOLE_X86_64_INFO)))
Пример #17
0
    def test_info_available(self):
        """Test whether only packages in the repository are listed."""
        with support.patch_std_streams() as (stdout, _):
            self._cmd.run('updates', ['available'])

        self.assertEqual(
            stdout.getvalue(), ''.join(
                (self.AVAILABLE_TITLE, self.HOLE_I686_INFO,
                 self.HOLE_X86_64_INFO, self.PEPPER_UPDATES_INFO)))
Пример #18
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)
Пример #19
0
    def test_info_recent(self):
        """Test whether only packages in the repository are listed."""
        with mock.patch('time.time', return_value=0), \
                support.patch_std_streams() as (stdout, _):
            self._cmd.run('updates', ['recent'])

        self.assertEqual(
            stdout.getvalue(), ''.join(
                (u'Recently Added Packages\n', self.HOLE_I686_INFO,
                 self.HOLE_X86_64_INFO, self.PEPPER_UPDATES_INFO)))
Пример #20
0
    def test_info_available(self):
        """Test whether only packages in the repository are listed."""
        cmd = dnf.cli.commands.RepoPkgsCommand.InfoSubCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            cmd.run_on_repo('updates', ['available'])

        self.assertEqual(
            stdout.getvalue(), ''.join(
                (self.AVAILABLE_TITLE, self.HOLE_I686_INFO,
                 self.HOLE_X86_64_INFO, self.PEPPER_UPDATES_INFO)))
Пример #21
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)
Пример #22
0
    def test_info_obsoletes(self):
        """Test whether only obsoletes in the repository are listed."""
        cmd = dnf.cli.commands.RepoPkgsCommand.InfoSubCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            cmd.run_on_repo('updates', ['obsoletes'])

        self.assertEqual(
            stdout.getvalue(), ''.join(
                (u'Obsoleting Packages\n', self.HOLE_I686_INFO,
                 self.HOLE_X86_64_INFO)))
Пример #23
0
    def test_info_obsoletes(self):
        """Test whether only obsoletes in the repository are listed."""
        with support.patch_std_streams() as (stdout, _):
            self._cmd.run('updates', ['obsoletes'])

        self.assertEqual(
            stdout.getvalue(),
            ''.join((
                u'Obsoleting Packages\n',
                self.HOLE_I686_INFO,
                self.HOLE_X86_64_INFO)))
Пример #24
0
    def test_info_installed(self):
        """Test whether only packages installed from the repository are listed."""
        for pkg in self._cmd.base.sack.query().installed().filter(name='pepper'):
            self._cmd.base.yumdb.db[str(pkg)] = support.RPMDBAdditionalDataPackageStub()
            self._cmd.base.yumdb.get_package(pkg).from_repo = 'main'

        with support.patch_std_streams() as (stdout, _):
            self._cmd.run('main', ['installed'])

        self.assertEqual(
            stdout.getvalue(),
            ''.join((self.INSTALLED_TITLE, self.PEPPER_SYSTEM_INFO)))
Пример #25
0
    def test_info_available(self):
        """Test whether only packages in the repository are listed."""
        with support.patch_std_streams() as (stdout, _):
            self._cmd.run('updates', ['available'])

        self.assertEqual(
            stdout.getvalue(),
            ''.join((
                self.AVAILABLE_TITLE,
                self.HOLE_I686_INFO,
                self.HOLE_X86_64_INFO,
                self.PEPPER_UPDATES_INFO)))
Пример #26
0
    def test_info_obsoletes(self):
        """Test whether only obsoletes in the repository are listed."""
        cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            support.command_run(cmd, ['updates', 'info', 'obsoletes'])

        self.assertEqual(
            stdout.getvalue(),
            ''.join((
                u'Obsoleting Packages\n',
                self.HOLE_I686_INFO,
                self.HOLE_X86_64_INFO)))
Пример #27
0
    def test_info_installed(self):
        """Test whether only packages installed from the repository are listed."""
        for pkg in self._cmd.base.sack.query().installed().filter(name='pepper'):
            self._cmd.base.yumdb.db[str(pkg)] = support.RPMDBAdditionalDataPackageStub()
            self._cmd.base.yumdb.get_package(pkg).from_repo = 'main'

        with support.patch_std_streams() as (stdout, _):
            self._cmd.run('main', ['installed'])

        self.assertEqual(
            stdout.getvalue(),
            ''.join((self.INSTALLED_TITLE, self.PEPPER_SYSTEM_INFO)))
Пример #28
0
    def test_info_installed(self):
        """Test whether only packages installed from the repository are listed."""
        history = self.cli.base.history
        for pkg in self.cli.base.sack.query().installed().filter(name='pepper'):
            mockSwdbPkg(history, pkg, repo='main')

        cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            support.command_run(cmd, ['main', 'info', 'installed'])

        self.assertEqual(
            stdout.getvalue(),
            ''.join((self.INSTALLED_TITLE, self.PEPPER_SYSTEM_INFO)))
Пример #29
0
    def test_info_recent(self):
        """Test whether only packages in the repository are listed."""
        with mock.patch('time.time', return_value=0), \
                support.patch_std_streams() as (stdout, _):
            self._cmd.run('updates', ['recent'])

        self.assertEqual(
            stdout.getvalue(),
            ''.join((
                u'Recently Added Packages\n',
                self.HOLE_I686_INFO,
                self.HOLE_X86_64_INFO,
                self.PEPPER_UPDATES_INFO)))
Пример #30
0
    def test_info_available(self):
        """Test whether only packages in the repository are listed."""
        cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            support.command_run(cmd, ['updates', 'info', 'available'])

        self.assertEqual(
            stdout.getvalue(),
            ''.join((
                self.AVAILABLE_TITLE,
                self.HOLE_I686_INFO,
                self.HOLE_X86_64_INFO,
                self.PEPPER_UPDATES_INFO)))
Пример #31
0
    def test_info_installed(self):
        """Test whether only packages installed from the repository are listed."""
        history = self.cli.base.history
        for pkg in self.cli.base.sack.query().installed().filter(
                name='pepper'):
            mockSwdbPkg(history, pkg, repo='main')

        cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            support.command_run(cmd, ['main', 'info', 'installed'])

        self.assertEqual(
            stdout.getvalue(), ''.join(
                (self.INSTALLED_TITLE, self.PEPPER_SYSTEM_INFO)))
Пример #32
0
 def test_rpm_logging(self):
     # log everything to the console:
     self.logging.setup(dnf.logging.SUBDEBUG, dnf.logging.SUBDEBUG,
                       self.logdir)
     logger = logging.getLogger("dnf.rpm")
     with support.patch_std_streams() as (stdout, stderr):
         logger.info('rpm transaction happens.')
     # rpm logger never outputs to the console:
     self.assertEqual(stdout.getvalue(), "")
     self.assertEqual(stderr.getvalue(), "")
     logfile = os.path.join(self.logdir, "dnf.rpm.log")
     self.assertFile(logfile)
     with open(logfile) as f:
         msgs =  map(operator.attrgetter("message"),
                     map(_split_logfile_entry, f.readlines()))
     self.assertSequenceEqual(msgs, [dnf.const.LOG_MARKER,
                                     'rpm transaction happens.'])
Пример #33
0
 def test_file_logging(self):
     # log nothing to the console:
     self.logging._setup(dnf.logging.SUPERCRITICAL,
                         dnf.logging.SUPERCRITICAL, self.logdir)
     logger = logging.getLogger("dnf")
     with support.patch_std_streams() as (stdout, stderr):
         logger.info("i")
         logger.critical("c")
     self.assertEqual(stdout.getvalue(), '')
     self.assertEqual(stderr.getvalue(), '')
     # yet the file should contain both the entries:
     logfile = os.path.join(self.logdir, "dnf.log")
     self.assertFile(logfile)
     with open(logfile) as f:
         msgs = map(operator.attrgetter("message"),
                    map(_split_logfile_entry, f.readlines()))
     self.assertSequenceEqual(list(msgs), [dnf.const.LOG_MARKER, 'i', 'c'])
Пример #34
0
 def test_file_logging(self):
     # log nothing to the console:
     self.logging.setup(dnf.logging.SUPERCRITICAL, dnf.logging.SUPERCRITICAL,
                       self.logdir)
     logger = logging.getLogger("dnf")
     with support.patch_std_streams() as (stdout, stderr):
         logger.info("i")
         logger.critical("c")
     self.assertEqual(stdout.getvalue(), '')
     self.assertEqual(stderr.getvalue(), '')
     # yet the file should contain both the entries:
     logfile = os.path.join(self.logdir, "dnf.log")
     self.assertFile(logfile)
     with open(logfile) as f:
         msgs =  map(operator.attrgetter("message"),
                     map(_split_logfile_entry, f.readlines()))
     self.assertSequenceEqual(msgs, [dnf.const.LOG_MARKER, 'i', 'c'])
Пример #35
0
 def test_rpm_logging(self):
     # log everything to the console:
     self.logging._setup(dnf.logging.SUBDEBUG, dnf.logging.SUBDEBUG,
                         self.logdir)
     logger = logging.getLogger("dnf.rpm")
     with support.patch_std_streams() as (stdout, stderr):
         logger.info('rpm transaction happens.')
     # rpm logger never outputs to the console:
     self.assertEqual(stdout.getvalue(), "")
     self.assertEqual(stderr.getvalue(), "")
     logfile = os.path.join(self.logdir, "dnf.rpm.log")
     self.assertFile(logfile)
     with open(logfile) as f:
         msgs = map(operator.attrgetter("message"),
                    map(_split_logfile_entry, f.readlines()))
     self.assertSequenceEqual(
         list(msgs), [dnf.const.LOG_MARKER, 'rpm transaction happens.'])
Пример #36
0
    def test_info_upgrades(self):
        """Test whether only upgrades in the repository are listed."""
        with support.patch_std_streams() as (stdout, _):
            self._cmd.run('updates', ['upgrades'])

        self.assertEqual(
            stdout.getvalue(), ''.join(
                (u'Upgraded Packages\n'
                 u'Name        : hole\n'
                 u'Arch        : x86_64\n'
                 u'Epoch       : 0\n'
                 u'Version     : 1\n'
                 u'Release     : 2\n'
                 u'Size        : 0.0  \n'
                 u'Repo        : updates\n'
                 u'Summary     : \n'
                 u'License     : \n'
                 u'Description : \n'
                 u'\n', self.HOLE_X86_64_INFO, self.PEPPER_UPDATES_INFO)))
Пример #37
0
    def test_info_upgrades(self):
        """Test whether only upgrades in the repository are listed."""
        cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            support.command_run(cmd, ['updates', 'info', 'upgrades'])

        self.assertEqual(
            stdout.getvalue(), ''.join(
                (u'Upgraded Packages\n'
                 u'Name         : hole\n'
                 u'Version      : 1\n'
                 u'Release      : 2\n'
                 u'Arch         : x86_64\n'
                 u'Size         : 0.0  \n'
                 u'Source       : None\n'
                 u'Repo         : updates\n'
                 u'Summary      : \n'
                 u'License      : \n'
                 u'Description  : \n'
                 u'\n', self.HOLE_X86_64_INFO, self.PEPPER_UPDATES_INFO)))
Пример #38
0
    def test_info_upgrades(self):
        """Test whether only upgrades in the repository are listed."""
        with support.patch_std_streams() as (stdout, _):
            self._cmd.run('updates', ['upgrades'])

        self.assertEqual(
            stdout.getvalue(),
            ''.join((
                u'Upgraded Packages\n'
                u'Name        : hole\n'
                u'Arch        : x86_64\n'
                u'Epoch       : 0\n'
                u'Version     : 1\n'
                u'Release     : 2\n'
                u'Size        : 0.0  \n'
                u'Repo        : updates\n'
                u'Summary     : \n'
                u'License     : None\n'
                u'Description : \n'
                u'\n',
                self.HOLE_X86_64_INFO,
                self.PEPPER_UPDATES_INFO)))
Пример #39
0
    def test_info_all(self):
        """Test whether only packages related to the repository are listed."""
        for pkg in self.cli.base.sack.query().installed().filter(name='pepper'):
            self.cli.base._yumdb.db[str(pkg)] = support.RPMDBAdditionalDataPackageStub()
            self.cli.base._yumdb.get_package(pkg).from_repo = 'main'

        cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            support.command_run(cmd, ['main', 'info', 'all', '*p*'])

        self.assertEqual(
            stdout.getvalue(),
            ''.join((
                self.INSTALLED_TITLE,
                self.PEPPER_SYSTEM_INFO,
                self.AVAILABLE_TITLE,
                u'Name         : pepper\n'
                u'Version      : 20\n'
                u'Release      : 0\n'
                u'Arch         : src\n'
                u'Size         : 0.0  \n'
                u'Source       : None\n'
                u'Repo         : main\n'
                u'Summary      : \n'
                u'License      : \n'
                u'Description  : \n'
                u'\n',
                u'Name         : trampoline\n'
                u'Version      : 2.1\n'
                u'Release      : 1\n'
                u'Arch         : noarch\n'
                u'Size         : 0.0  \n'
                u'Source       : None\n'
                u'Repo         : main\n'
                u'Summary      : \n'
                u'License      : \n'
                u'Description  : \n'
                u'\n')))
Пример #40
0
    def test_info_extras(self):
        """Test whether only extras installed from the repository are listed."""
        for pkg in self._cmd.base.sack.query().installed().filter(name='tour'):
            self._cmd.base.yumdb.db[str(
                pkg)] = support.RPMDBAdditionalDataPackageStub()
            self._cmd.base.yumdb.get_package(pkg).from_repo = 'unknown'

        with support.patch_std_streams() as (stdout, _):
            self._cmd.run('unknown', ['extras'])

        self.assertEqual(
            stdout.getvalue(), u'Extra Packages\n'
            u'Name        : tour\n'
            u'Arch        : noarch\n'
            u'Epoch       : 0\n'
            u'Version     : 5\n'
            u'Release     : 0\n'
            u'Size        : 0.0  \n'
            u'Repo        : @System\n'
            u'From repo   : unknown\n'
            u'Summary     : \n'
            u'License     : \n'
            u'Description : \n\n')
Пример #41
0
    def test_info_extras(self):
        """Test whether only extras installed from the repository are listed."""
        history = self.cli.base.history
        for pkg in self.cli.base.sack.query().installed().filter(name='tour'):
            mockSwdbPkg(history, pkg, repo='main')

        cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            support.command_run(cmd, ['main', 'info', 'extras'])

        self.assertEqual(
            stdout.getvalue(), u'Extra Packages\n'
            u'Name         : tour\n'
            u'Version      : 5\n'
            u'Release      : 0\n'
            u'Arch         : noarch\n'
            u'Size         : 0.0  \n'
            u'Source       : None\n'
            u'Repo         : @System\n'
            u'From repo    : main\n'
            u'Summary      : \n'
            u'License      : \n'
            u'Description  : \n\n')
Пример #42
0
    def test_info_extras(self):
        """Test whether only extras installed from the repository are listed."""
        for pkg in self._cmd.base.sack.query().installed().filter(name='tour'):
            self._cmd.base.yumdb.db[str(pkg)] = support.RPMDBAdditionalDataPackageStub()
            self._cmd.base.yumdb.get_package(pkg).from_repo = 'unknown'

        with support.patch_std_streams() as (stdout, _):
            self._cmd.run('unknown', ['extras'])

        self.assertEqual(
            stdout.getvalue(),
            u'Extra Packages\n'
            u'Name        : tour\n'
            u'Arch        : noarch\n'
            u'Epoch       : 0\n'
            u'Version     : 5\n'
            u'Release     : 0\n'
            u'Size        : 0.0  \n'
            u'Repo        : @System\n'
            u'From repo   : unknown\n'
            u'Summary     : \n'
            u'License     : None\n'
            u'Description : \n\n')
Пример #43
0
    def test(self):
        """Test whether only upgrades in the repository are listed."""
        with support.patch_std_streams() as (stdout, _):
            self._cmd.run('updates', [])

        self.assertEqual(
            stdout.getvalue(), u'\n'
            u'hole.x86_64                               1-2'
            u'                            updates\n'
            u'hole.x86_64                               2-1'
            u'                            updates\n'
            u'pepper.x86_64                             20-1'
            u'                           updates\n'
            u'Obsoleting Packages\n'
            u'hole.i686                                 2-1'
            u'                            updates\n'
            u'    tour.noarch                           5-0'
            u'                            @System\n'
            u'hole.x86_64                               2-1'
            u'                            updates\n'
            u'    tour.noarch                           5-0'
            u'                            @System\n')
        self.assertEqual(self.cli.demands.success_exit_status, 100)
Пример #44
0
    def test_info_extras(self):
        """Test whether only extras installed from the repository are listed."""
        history = self.cli.base.history
        for pkg in self.cli.base.sack.query().installed().filter(name='tour'):
            mockSwdbPkg(history, pkg, repo='main')

        cmd = dnf.cli.commands.RepoPkgsCommand(self.cli)
        with support.patch_std_streams() as (stdout, _):
            support.command_run(cmd, ['main', 'info', 'extras'])

        self.assertEqual(
            stdout.getvalue(),
            u'Extra Packages\n'
            u'Name         : tour\n'
            u'Version      : 5\n'
            u'Release      : 0\n'
            u'Arch         : noarch\n'
            u'Size         : 0.0  \n'
            u'Source       : None\n'
            u'Repo         : @System\n'
            u'From repo    : main\n'
            u'Summary      : \n'
            u'License      : \n'
            u'Description  : \n\n')
Пример #45
0
    def test(self):
        """Test whether only upgrades in the repository are listed."""
        with support.patch_std_streams() as (stdout, _):
            self._cmd.run('updates', [])

        self.assertEqual(
            stdout.getvalue(),
            u'\n'
            u'hole.x86_64                               1-2'
            u'                            updates\n'
            u'hole.x86_64                               2-1'
            u'                            updates\n'
            u'pepper.x86_64                             20-1'
            u'                           updates\n'
            u'Obsoleting Packages\n'
            u'hole.i686                                 2-1'
            u'                            updates\n'
            u'    tour.noarch                           5-0'
            u'                            @System\n'
            u'hole.x86_64                               2-1'
            u'                            updates\n'
            u'    tour.noarch                           5-0'
            u'                            @System\n')
        self.assertEqual(self._cmd.success_retval, 100)
Пример #46
0
 def test_conflict(self):
     with self.assertRaises(SystemExit) as sysexit, \
         support.patch_std_streams() as (stdout, stderr):
         support.command_configure(self.cmd,
                                   ['--conflicts', '%{name}', '--provides'])
     self.assertEqual(sysexit.exception.code, 1)
Пример #47
0
 def test_group_verbose_info(self, _term_width):
     group = self.base.comps.group_by_pattern('Peppers')
     self.output.conf.verbose = True
     with support.patch_std_streams() as (stdout, stderr):
         self.output.displayPkgsInGroups(group)
     self.assertEqual(stdout.getvalue(), PKGS_IN_GROUPS_VERBOSE_OUTPUT)
Пример #48
0
 def test_conflict(self):
     with self.assertRaises(SystemExit) as sysexit, \
         support.patch_std_streams() as (stdout, stderr):
         support.command_configure(self.cmd,
                                   ['--conflicts', '%{name}', '--provides'])
     self.assertEqual(sysexit.exception.code, 1)
Пример #49
0
 def patched_search(self, *args):
     with support.patch_std_streams() as (stdout, _):
         support.command_run(self.cmd, *args)
         call_args = self.base.output.matchcallback.call_args_list
         pkgs = [c[0][0] for c in call_args]
         return (stdout.getvalue(), pkgs)
Пример #50
0
 def test_group_verbose_info(self, _term_width):
     group = self.base.comps.group_by_pattern('Peppers')
     self.output.conf.verbose = True
     with support.patch_std_streams() as (stdout, stderr):
         self.output.display_pkgs_in_groups(group)
     self.assertEqual(stdout.getvalue(), PKGS_IN_GROUPS_VERBOSE_OUTPUT)
Пример #51
0
 def patched_search(self, *args, **kwargs):
     with support.patch_std_streams() as (stdout, stderr):
         self.cli.search(*args, **kwargs)
         call_args = self.yumbase.output.matchcallback.call_args_list
         pkgs = [c[0][0] for c in call_args]
         return (stdout.getvalue(), pkgs)
Пример #52
0
 def test_environment_info(self, _term_width):
     env = self.base.comps.environments[0]
     with support.patch_std_streams() as (stdout, stderr):
         self.output.display_groups_in_environment(env)
     self.assertEqual(stdout.getvalue(), GROUPS_IN_ENVIRONMENT_OUTPUT)
Пример #53
0
 def test_group_info(self, _term_width):
     group = self.base.comps.group_by_pattern('Peppers')
     with support.patch_std_streams() as (stdout, stderr):
         self.output.displayPkgsInGroups(group)
     self.assertEqual(stdout.getvalue(), PKGS_IN_GROUPS_OUTPUT)
Пример #54
0
 def test_group_info(self, _term_width):
     group = self.base.comps.group_by_pattern('Peppers')
     with support.patch_std_streams() as (stdout, stderr):
         self.output.display_pkgs_in_groups(group)
     self.assertEqual(stdout.getvalue(), PKGS_IN_GROUPS_OUTPUT)
Пример #55
0
 def test_environment_info(self, _term_width):
     env = self.base.comps.environments[0]
     with support.patch_std_streams() as (stdout, stderr):
         self.output.display_groups_in_environment(env)
     self.assertEqual(stdout.getvalue(), GROUPS_IN_ENVIRONMENT_OUTPUT)
Пример #56
0
 def test_group_verbose_info(self, _term_width):
     group = self.base.comps.group_by_pattern('Peppers')
     self.base.set_debuglevel(dnf.const.VERBOSE_LEVEL)
     with support.patch_std_streams() as (stdout, stderr):
         self.output.display_pkgs_in_groups(group)
     self.assertEqual(stdout.getvalue(), PKGS_IN_GROUPS_VERBOSE_OUTPUT)
Пример #57
0
 def patched_search(self, *args, **kwargs):
     with support.patch_std_streams() as (stdout, _):
         self.cmd._search(*args, **kwargs)
         call_args = self.base.output.matchcallback.call_args_list
         pkgs = [c[0][0] for c in call_args]
         return (stdout.getvalue(), pkgs)