Exemplo n.º 1
0
 def setUp( self ):
     self.sv_policy = MetadataElementPolicy( 0 )
     self.mv_policy = MetadataElementPolicy( 1 )
Exemplo n.º 2
0
 def setUp(self):
     self.sv_policy = MetadataElementPolicy(0)
     self.mv_policy = MetadataElementPolicy(1)
Exemplo n.º 3
0
class TestMetadataElementPolicy( TestCase ):

    def setUp( self ):
        self.sv_policy = MetadataElementPolicy( 0 )
        self.mv_policy = MetadataElementPolicy( 1 )

    def tearDown( self ):
        del self.sv_policy
        del self.mv_policy

    def test_emptySV( self ):
        assert not self.sv_policy.isMultiValued()
        assert not self.sv_policy.isRequired()
        assert not self.sv_policy.supplyDefault()
        assert not self.sv_policy.defaultValue()
        assert not self.sv_policy.enforceVocabulary()
        assert not self.sv_policy.allowedVocabulary()

    def test_editSV( self ):
        self.sv_policy.edit( 1, 1, 'xxx', 0, '' )
        assert not self.sv_policy.isMultiValued()
        assert self.sv_policy.isRequired()
        assert self.sv_policy.supplyDefault()
        assert self.sv_policy.defaultValue() == 'xxx'
        assert not self.sv_policy.enforceVocabulary()
        assert not self.sv_policy.allowedVocabulary()

    def test_emptyMV( self ):
        assert self.mv_policy.isMultiValued()
        assert not self.mv_policy.isRequired()
        assert not self.mv_policy.supplyDefault()
        assert not self.mv_policy.defaultValue()
        assert not self.mv_policy.enforceVocabulary()
        assert not self.mv_policy.allowedVocabulary()

    def test_editMV( self ):
        self.mv_policy.edit( 1, 1, 'xxx', 1, ( 'xxx', 'yyy' ) )
        assert self.mv_policy.isMultiValued()
        assert self.mv_policy.isRequired()
        assert self.mv_policy.supplyDefault()
        assert self.mv_policy.defaultValue() == 'xxx'
        assert self.mv_policy.enforceVocabulary()
        assert len( self.mv_policy.allowedVocabulary() ) == 2
        assert 'xxx' in self.mv_policy.allowedVocabulary()
        assert 'yyy' in self.mv_policy.allowedVocabulary()
Exemplo n.º 4
0
class TestMetadataElementPolicy(TestCase):
    def setUp(self):
        self.sv_policy = MetadataElementPolicy(0)
        self.mv_policy = MetadataElementPolicy(1)

    def tearDown(self):
        del self.sv_policy
        del self.mv_policy

    def test_emptySV(self):
        assert not self.sv_policy.isMultiValued()
        assert not self.sv_policy.isRequired()
        assert not self.sv_policy.supplyDefault()
        assert not self.sv_policy.defaultValue()
        assert not self.sv_policy.enforceVocabulary()
        assert not self.sv_policy.allowedVocabulary()

    def test_editSV(self):
        self.sv_policy.edit(1, 1, 'xxx', 0, '')
        assert not self.sv_policy.isMultiValued()
        assert self.sv_policy.isRequired()
        assert self.sv_policy.supplyDefault()
        assert self.sv_policy.defaultValue() == 'xxx'
        assert not self.sv_policy.enforceVocabulary()
        assert not self.sv_policy.allowedVocabulary()

    def test_emptyMV(self):
        assert self.mv_policy.isMultiValued()
        assert not self.mv_policy.isRequired()
        assert not self.mv_policy.supplyDefault()
        assert not self.mv_policy.defaultValue()
        assert not self.mv_policy.enforceVocabulary()
        assert not self.mv_policy.allowedVocabulary()

    def test_editMV(self):
        self.mv_policy.edit(1, 1, 'xxx', 1, ('xxx', 'yyy'))
        assert self.mv_policy.isMultiValued()
        assert self.mv_policy.isRequired()
        assert self.mv_policy.supplyDefault()
        assert self.mv_policy.defaultValue() == 'xxx'
        assert self.mv_policy.enforceVocabulary()
        assert len(self.mv_policy.allowedVocabulary()) == 2
        assert 'xxx' in self.mv_policy.allowedVocabulary()
        assert 'yyy' in self.mv_policy.allowedVocabulary()