Ejemplo n.º 1
0
 def test_inherit_success(self):
     '''
     Tests zfs inherit of compression property
     '''
     res = {'myzpool/mydataset': {'compression': 'cleared'}}
     ret = {'pid': 45193, 'retcode': 0, 'stderr': '', 'stdout': ''}
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}):
         self.assertEqual(zfs.inherit('compression', 'myzpool/mydataset'), res)
Ejemplo n.º 2
0
def test_inherit_success(utils_patch):
    """
    Tests zfs inherit of compression property
    """
    res = OrderedDict([("inherited", True)])
    ret = {"pid": 45193, "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):
        assert res == zfs.inherit("compression", "myzpool/mydataset")
Ejemplo n.º 3
0
 def test_inherit_failure(self):
     '''
     Tests zfs inherit of canmount
     '''
     res = {
         'myzpool/mydataset': {
             'canmount': "'canmount' property cannot be inherited, use revert=True to try and reset it to it's default value."
         }
     }
     ret = {'pid': 43898, 'retcode': 1, 'stderr': "'canmount' property cannot be inherited", 'stdout': ''}
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}):
         self.assertEqual(zfs.inherit('canmount', 'myzpool/mydataset'), res)
Ejemplo n.º 4
0
 def test_inherit_failure(self):
     """
     Tests zfs inherit of canmount
     """
     res = OrderedDict([
         ("inherited", False),
         ("error", "'canmount' property cannot be inherited"),
     ])
     ret = {
         "pid": 43898,
         "retcode": 1,
         "stderr": "'canmount' property cannot be inherited",
         "stdout": "",
     }
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(zfs.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
             zfs.__utils__, self.utils_patch):
         self.assertEqual(res, zfs.inherit("canmount", "myzpool/mydataset"))