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