Esempio n. 1
0
    def test_create_defaults(self):
        mdref = metsrw.MDRef('path/to/file.txt', 'PREMIS:DUMMY', 'URL')
        mdreffed = mdref.serialize()

        assert mdreffed.get('LOCTYPE') == 'URL'
        assert mdreffed.get(metsrw.lxmlns('xlink') +
                            'href') == 'path/to/file.txt'
        assert mdreffed.get('MDTYPE') == 'PREMIS:DUMMY'
Esempio n. 2
0
 def test_create_bad_loctype(self):
     metsrw.MDRef(None, None, loctype='ARK')
     metsrw.MDRef(None, None, loctype='URN')
     metsrw.MDRef(None, None, loctype='URL')
     metsrw.MDRef(None, None, loctype='PURL')
     metsrw.MDRef(None, None, loctype='HANDLE')
     metsrw.MDRef(None, None, loctype='DOI')
     metsrw.MDRef(None, None, loctype='OTHER')
     with pytest.raises(ValueError):
         metsrw.MDRef(None, None, loctype='BAD')
Esempio n. 3
0
    def test_create_extra_params(self):
        mdref = metsrw.MDRef(target='path/to/file.txt',
                             mdtype='OTHER',
                             label='Label',
                             loctype='OTHER',
                             otherloctype='OUTSIDE')
        mdreffed = mdref.serialize()

        assert mdreffed.get('LOCTYPE') == 'OTHER'
        assert mdreffed.get('OTHERLOCTYPE') == 'OUTSIDE'
        assert mdreffed.get(metsrw.lxmlns('xlink') +
                            'href') == 'path/to/file.txt'
        assert mdreffed.get('MDTYPE') == 'OTHER'