def test_exists_success(self): ''' Tests successful return of exists function ''' ret = "NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT\nmyzpool 149G 128K 149G 0% 1.00x ONLINE -" mock_cmd = MagicMock(return_value=ret) with patch.dict(zpool.__salt__, {'cmd.run': mock_cmd}): self.assertTrue(zpool.exists('myzpool'))
def test_exists_failure(self): ''' Tests failure return of exists function ''' ret = {} ret['stdout'] = "" ret['stderr'] = "cannot open 'myzpool': no such pool" ret['retcode'] = 1 mock_cmd = MagicMock(return_value=ret) with patch.dict(zpool.__salt__, {'cmd.run_all': mock_cmd}): self.assertFalse(zpool.exists('myzpool'))
def test_exists_failure(self): """ Tests failure return of exists function """ ret = {} ret["stdout"] = "" ret["stderr"] = "cannot open 'myzpool': no such pool" ret["retcode"] = 1 mock_cmd = MagicMock(return_value=ret) with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict( zpool.__utils__, self.utils_patch): self.assertFalse(zpool.exists("myzpool"))
def test_exists_success(self): ''' Tests successful return of exists function ''' ret = {} ret['stdout'] = "NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT\n" \ "myzpool 149G 128K 149G 0% 1.00x ONLINE -" ret['stderr'] = "" ret['retcode'] = 0 mock_cmd = MagicMock(return_value=ret) with patch.dict(zpool.__salt__, {'cmd.run_all': mock_cmd}), \ patch.dict(zpool.__utils__, self.utils_patch): self.assertTrue(zpool.exists('myzpool'))
def test_exists_success(self): """ Tests successful return of exists function """ ret = {} ret["stdout"] = ( "NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT\n" "myzpool 149G 128K 149G 0% 1.00x ONLINE -") ret["stderr"] = "" ret["retcode"] = 0 mock_cmd = MagicMock(return_value=ret) with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict( zpool.__utils__, self.utils_patch): self.assertTrue(zpool.exists("myzpool"))