Example #1
0
    def test_bookmark_absent_nobook(self):
        '''
        Test if bookmark is absent (non existing bookmark)
        '''
        ret = {
            'name': 'myzpool/filesystem#book',
            'result': True,
            'comment': 'bookmark myzpool/filesystem#book is absent',
            'changes': {}
        }

        mock_exists = MagicMock(return_value=False)
        with patch.dict(zfs.__salt__, {'zfs.exists': mock_exists}), \
             patch.dict(zfs.__utils__, utils_patch):
            self.assertEqual(ret,
                             zfs.bookmark_absent('myzpool/filesystem#book'))
Example #2
0
    def test_bookmark_absent_removed(self):
        '''
        Test if bookmark is absent
        '''
        ret = {
            'name': 'myzpool/filesystem#book',
            'result': True,
            'comment': 'bookmark myzpool/filesystem#book was destroyed',
            'changes': {
                'myzpool/filesystem#book': 'destroyed'
            }
        }

        mock_exists = MagicMock(return_value=True)
        mock_destroy = MagicMock(return_value=OrderedDict([('destroyed',
                                                            True)]))
        with patch.dict(zfs.__salt__, {'zfs.exists': mock_exists}), \
             patch.dict(zfs.__salt__, {'zfs.destroy': mock_destroy}), \
             patch.dict(zfs.__utils__, utils_patch):
            self.assertEqual(ret,
                             zfs.bookmark_absent('myzpool/filesystem#book'))