Esempio n. 1
0
    def test_file_list(self):
        '''
        Test if it lists the files that belong to a package.
        '''
        mock = MagicMock(return_value={'retcode': 0,
                                       'stderr': '',
                                       'stdout': 'Salt'})
        with patch.dict(dpkg.__salt__, {'cmd.run_all': mock}):
            self.assertDictEqual(dpkg.file_list('httpd'),
                                 {'errors': [], 'files': []})

        mock = MagicMock(return_value={'retcode': 1,
                                       'stderr': 'error',
                                       'stdout': 'Salt'})
        with patch.dict(dpkg.__salt__, {'cmd.run_all': mock}):
            self.assertEqual(dpkg.file_list('httpd'), 'Error:  error')
Esempio n. 2
0
    def test_file_list(self):
        '''
        Test if it lists the files that belong to a package.
        '''
        mock = MagicMock(return_value={'retcode': 0,
                                       'stderr': '',
                                       'stdout': 'Salt'})
        with patch.dict(dpkg.__salt__, {'cmd.run_all': mock}):
            self.assertDictEqual(dpkg.file_list('httpd'),
                                 {'errors': [], 'files': []})

        mock = MagicMock(return_value={'retcode': 1,
                                       'stderr': 'error',
                                       'stdout': 'Salt'})
        with patch.dict(dpkg.__salt__, {'cmd.run_all': mock}):
            self.assertEqual(dpkg.file_list('httpd'), 'Error:  error')