def test_scrub_stop(self): ''' Tests pauze of scrub ''' ret = {} ret['stdout'] = "" ret['stderr'] = "" ret['retcode'] = 0 mock_cmd = MagicMock(return_value=ret) mock_exists = MagicMock(return_value=True) with patch.dict(zpool.__salt__, {'zpool.exists': mock_exists}), \ patch.dict(zpool.__salt__, {'cmd.run_all': mock_cmd}), \ patch.dict(zpool.__utils__, self.utils_patch): ret = zpool.scrub('mypool', stop=True) res = OrderedDict(OrderedDict([('scrubbing', False)])) self.assertEqual(ret, res)
def test_scrub_start(self): ''' Tests start of scrub ''' ret = {} ret['stdout'] = "" ret['stderr'] = "" ret['retcode'] = 0 mock_cmd = MagicMock(return_value=ret) mock_exists = MagicMock(return_value=True) with patch.dict(zpool.__salt__, {'zpool.exists': mock_exists}): with patch.dict(zpool.__salt__, {'cmd.run_all': mock_cmd}): ret = zpool.scrub('mypool') res = OrderedDict([('mypool', OrderedDict([('scrubbing', True) ]))]) self.assertEqual(res, ret)
def test_scrub_stop(utils_patch): """ Tests pauze of scrub """ ret = {} ret["stdout"] = "" ret["stderr"] = "" ret["retcode"] = 0 mock_cmd = MagicMock(return_value=ret) mock_exists = MagicMock(return_value=True) with patch.dict(zpool.__salt__, {"zpool.exists": mock_exists}), patch.dict( zpool.__salt__, {"cmd.run_all": mock_cmd} ), patch.dict(zpool.__utils__, utils_patch): ret = zpool.scrub("mypool", stop=True) res = OrderedDict(OrderedDict([("scrubbing", False)])) assert ret == res
def test_scrub_start(self): """ Tests start of scrub """ ret = {} ret["stdout"] = "" ret["stderr"] = "" ret["retcode"] = 0 mock_cmd = MagicMock(return_value=ret) mock_exists = MagicMock(return_value=True) with patch.dict(zpool.__salt__, {"zpool.exists": mock_exists}), patch.dict( zpool.__salt__, {"cmd.run_all": mock_cmd} ), patch.dict(zpool.__utils__, self.utils_patch): ret = zpool.scrub("mypool") res = OrderedDict(OrderedDict([("scrubbing", True)])) self.assertEqual(ret, res)