コード例 #1
0
ファイル: test_zfs.py プロジェクト: jgleissner/salt-2
 def test_promote_success(self):
     '''
     Tests zfs promote success
     '''
     res = OrderedDict([('promoted', True)])
     ret = {'pid': 69075, '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.promote('myzpool/yesterday'))
コード例 #2
0
ファイル: test_zfs.py プロジェクト: jgleissner/salt-2
 def test_promote_failure(self):
     '''
     Tests zfs promote failure
     '''
     res = OrderedDict([
         ('promoted', False),
         ('error',
          "cannot promote 'myzpool/yesterday': not a cloned filesystem"),
     ])
     ret = {
         'pid': 69209,
         'retcode': 1,
         'stderr':
         "cannot promote 'myzpool/yesterday': not a cloned filesystem",
         '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.promote('myzpool/yesterday'))