Пример #1
0
    def test_get_properties_poolname_nometa_happy(self):
        def mock_get_properties(myself, dataset, include_metadata):
            assert dataset == 'tank'
            assert include_metadata is False

        with patch.object(ZFS, '_get_properties', new=mock_get_properties):
            zfs = ZFS()
            zfs.get_properties('tank')
Пример #2
0
    def test_get_properties_dataset_unhappy(self):
        '''
        Tests that it validates the dataset name
        '''
        def mock_get_properties(myself, dataset, include_metadata):
            assert False, 'this should not have been called'

        with patch.object(ZFS, '_get_properties', new=mock_get_properties):
            zfs = ZFS()
            with pytest.raises(ValidationError):
                zfs.get_properties('as#df/tank')
Пример #3
0
 def test_get_properties_notimplemented(self):
     zfs = ZFS()
     with pytest.raises(NotImplementedError):
         zfs.get_properties('tank/test')