def test_unmount_success(self): ''' Tests zfs unmount of filesystem ''' res = OrderedDict([('unmounted', True)]) ret = {} ret['stdout'] = "" ret['stderr'] = "" ret['retcode'] = 0 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.unmount('myzpool/mydataset'))
def test_unmount_failure(self): ''' Tests zfs unmount of already mounted filesystem ''' res = OrderedDict([ ('unmounted', False), ('error', "cannot mount 'myzpool/mydataset': not currently mounted"), ]) ret = {} ret['stdout'] = "" ret['stderr'] = "cannot mount 'myzpool/mydataset': not currently mounted" ret['retcode'] = 1 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.unmount('myzpool/mydataset'))