コード例 #1
0
ファイル: test_zfs.py プロジェクト: jgleissner/salt-2
 def test_mount_success(self):
     '''
     Tests zfs mount of filesystem
     '''
     res = OrderedDict([('mounted', 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.mount('myzpool/mydataset'))
コード例 #2
0
ファイル: test_zfs.py プロジェクト: jgleissner/salt-2
 def test_mount_failure(self):
     '''
     Tests zfs mount of already mounted filesystem
     '''
     res = OrderedDict([
         ('mounted', False),
         ('error',
          "cannot mount 'myzpool/mydataset': filesystem already mounted")
     ])
     ret = {}
     ret['stdout'] = ""
     ret['stderr'] = "cannot mount 'myzpool/mydataset': filesystem already 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.mount('myzpool/mydataset'))