Exemplo n.º 1
0
 def test_info_installed(self):
     """
     Test - Return the information of the named package(s) installed on the system.
     """
     installed = copy.deepcopy(self.opkg_vim_info["vim"])
     del installed["Package"]
     ordered_info = collections.OrderedDict(sorted(installed.items()))
     expected_dict = {"vim": {k.lower(): v for k, v in ordered_info.items()}}
     std_out = "\n".join(
         [k + ": " + v for k, v in self.opkg_vim_info["vim"].items()]
     )
     ret_value = {"stdout": std_out, "retcode": 0}
     mock = MagicMock(return_value=ret_value)
     with patch.dict(opkg.__salt__, {"cmd.run_all": mock}):
         self.assertEqual(opkg.info_installed("vim"), expected_dict)
Exemplo n.º 2
0
 def test_info_installed(self):
     '''
     Test - Return the information of the named package(s) installed on the system.
     '''
     installed = copy.deepcopy(OPKG_VIM_INFO['vim'])
     del installed['Package']
     ordered_info = collections.OrderedDict(sorted(installed.items()))
     expected_dict = {'vim': {k.lower(): v for k, v in ordered_info.items()}}
     std_out = '\n'.join([k + ': ' + v for k, v in OPKG_VIM_INFO['vim'].items()])
     ret_value = {
         'stdout': std_out,
         'retcode': 0
     }
     mock = MagicMock(return_value=ret_value)
     with patch.dict(opkg.__salt__, {'cmd.run_all': mock}):
         self.assertEqual(opkg.info_installed('vim'), expected_dict)