示例#1
0
    def test_get_default_pid(self, mockpidman):
        # TODO: use override_settings once we get to django 1.6+
        # for now, manually add settings for testing
        _pidman_host = getattr(settings, 'PIDMAN_HOST', None)
        _pidman_domain = getattr(settings, 'PIDMAN_DOMAIN', None)

        settings.PIDMAN_HOST = 'http://pid.co'
        settings.PIDMAN_DOMAIN = 'http://pid.co/domains/123'

        mockpidman.create_ark.return_value = self.testark

        obj = Publication(Mock())
        obj.label = 'my test object'
        pid = obj.get_default_pid()
        self.assertEqual('%s:%s' % (settings.FEDORA_PIDSPACE, self.noid), pid)

        # ark_uri should be stored in dc.identifier
        self.assert_(self.testark in obj.dc.content.identifier_list)

        # ark_uri should be stored in descMetadata.ark_uri
        self.assert_(self.testark in obj.descMetadata.content.ark_uri)

        # ark should be stored in descMetadata.ark
        self.assert_("ark:/%s/%s" % (self.naan, self.noid) in obj.descMetadata.content.ark)

        settings.PIDMAN_HOST = _pidman_host
        settings.PIDMAN_DOMAIN = _pidman_domain
示例#2
0
 def test_noid(self):
     A = Publication(Mock())
     A.pid="test:efg12"
     self.assertEqual(A.noid, 'efg12')