Beispiel #1
0
 def test_inherit_success(self):
     '''
     Tests zfs inherit of compression property
     '''
     res = OrderedDict([('inherited', True)])
     ret = {'pid': 45193, 'retcode': 0, 'stderr': '', 'stdout': ''}
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
          patch.dict(zfs.__utils__, utils_patch):
         self.assertEqual(res,
                          zfs.inherit('compression', 'myzpool/mydataset'))
Beispiel #2
0
 def test_inherit_failure(self):
     '''
     Tests zfs inherit of canmount
     '''
     res = OrderedDict([
         ('inherited', False),
         ('error', "'canmount' property cannot be inherited"),
     ])
     ret = {
         'pid': 43898,
         'retcode': 1,
         'stderr': "'canmount' property cannot be inherited",
         'stdout': ''
     }
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}), \
          patch.dict(zfs.__utils__, utils_patch):
         self.assertEqual(res, zfs.inherit('canmount', 'myzpool/mydataset'))