Ejemplo n.º 1
0
 def test_get_pkg_id_from_pkginfo_no_file(self):
     '''
         Test getting a package id from pkginfo file when it doesn't exist
     '''
     expected = []
     mock = MagicMock(return_value='No such file')
     with patch.dict(macpackage.__salt__, {'cmd.run': mock}):
         out = macpackage._get_pkg_id_from_pkginfo('/tmp/dmg-X/PackageInfo')
         cmd = 'cat /tmp/dmg-X/PackageInfo | grep -Eo \'identifier="[a-zA-Z.0-9\\-]*"\' | ' \
               'cut -c 13- | tr -d \'"\''
         mock.assert_called_once_with(cmd, python_shell=True)
         self.assertEqual(out, expected)
Ejemplo n.º 2
0
 def test_get_pkg_id_from_pkginfo_no_file(self):
     '''
         Test getting a package id from pkginfo file when it doesn't exist
     '''
     expected = []
     mock = MagicMock(return_value='No such file')
     with patch.dict(macpackage.__salt__, {'cmd.run': mock}):
         out = macpackage._get_pkg_id_from_pkginfo('/tmp/dmg-X/PackageInfo')
         cmd = 'cat /tmp/dmg-X/PackageInfo | grep -Eo \'identifier="[a-zA-Z.0-9\\-]*"\' | ' \
               'cut -c 13- | tr -d \'"\''
         mock.assert_called_once_with(cmd, python_shell=True)
         self.assertEqual(out, expected)