Ejemplo n.º 1
0
 def test_bookmark_success(self):
     '''
     Tests zfs bookmark success
     '''
     res = {'myzpool/mydataset@yesterday': 'bookmarked as myzpool/mydataset#important'}
     ret = {'pid': 20990, 'retcode': 0, 'stderr': '', 'stdout': ''}
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(zfs.__salt__, {'cmd.run_all': mock_cmd}):
         self.assertEqual(zfs.bookmark('myzpool/mydataset@yesterday', 'myzpool/mydataset#important'), res)
Ejemplo n.º 2
0
def test_bookmark_success(utils_patch):
    """
    Tests zfs bookmark success
    """
    with patch("salt.utils.path.which",
               MagicMock(return_value="/usr/bin/man")):
        res = OrderedDict([("bookmarked", True)])
        ret = {"pid": 20990, "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.bookmark("myzpool/mydataset@yesterday",
                                       "myzpool/mydataset#important")