Exemplo n.º 1
0
    def test_group_info(self):
        '''
        Test if it shows the packages in a group
        '''
        def cmdlist(cmd, **kwargs):
            '''
            Handle several different commands being run
            '''
            if cmd == ['pacman', '-Sgg', 'testgroup']:
                return 'testgroup pkg1\ntestgroup pkg2'
            else:
                return 'Untested command ({0}, {1})!'.format(cmd, kwargs)

        cmdmock = MagicMock(side_effect=cmdlist)

        sortmock = MagicMock()
        with patch.dict(pacman.__salt__, {
                'cmd.run': cmdmock,
                'pkg_resource.sort_pkglist': sortmock
        }):
            self.assertEqual(
                pacman.group_info('testgroup')['default'], ['pkg1', 'pkg2'])
Exemplo n.º 2
0
    def test_group_info(self):
        '''
        Test if it shows the packages in a group
        '''

        def cmdlist(cmd, **kwargs):
            '''
            Handle several different commands being run
            '''
            if cmd == ['pacman', '-Sgg', 'testgroup']:
                return 'testgroup pkg1\ntestgroup pkg2'
            else:
                return 'Untested command ({0}, {1})!'.format(cmd, kwargs)

        cmdmock = MagicMock(side_effect=cmdlist)

        sortmock = MagicMock()
        with patch.dict(pacman.__salt__, {
                'cmd.run': cmdmock,
                'pkg_resource.sort_pkglist': sortmock
                }):
            self.assertEqual(pacman.group_info('testgroup')['default'], ['pkg1', 'pkg2'])