X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/6ff3ca2d4ba9d131d5a3a96e9f74573668980f0b..048c03a936a31dc5e1a1f14a8e2541e7fb28882d:/apps/oai/tests/oaipmhapi.py?ds=sidebyside diff --git a/apps/oai/tests/oaipmhapi.py b/apps/oai/tests/oaipmhapi.py index 08925f904..db57bc18b 100644 --- a/apps/oai/tests/oaipmhapi.py +++ b/apps/oai/tests/oaipmhapi.py @@ -1,8 +1,9 @@ - - +# -*- coding: utf-8 -*- +# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# from catalogue.test_utils import WLTestCase from catalogue import models -from nose.tools import raises from oai.handlers import * from oaipmh.server import * from os import path @@ -19,19 +20,17 @@ class BookMetadataTest(WLTestCase): xml = path.join(path.dirname(__file__), 'files/antygona.xml') self.book2 = models.Book.from_xml_file(xml) - self.catalogue = Catalogue() mr = MetadataRegistry() + self.catalogue = Catalogue(mr) + mr.registerWriter('oai_dc', oai_dc_writer) nsmap = {'oai_dc': NS_OAIDC, 'dc': NS_DC, 'xsi': NS_XSI} self.xml = XMLTreeServer(self.catalogue, mr, nsmap) def test_get_record(self): - sch = self.xml.getRecord(record='lubie-kiedy-kobieta', + self.xml.getRecord(identifier='lubie-kiedy-kobieta', metadataPrefix='oai_dc') - etree.dump(sch.getroot()) - sch = self.xml.listRecords(metadataPrefix='oai_dc') - etree.dump(sch.getroot()) + self.xml.listRecords(metadataPrefix='oai_dc') def test_selecting(self): records, token = self.catalogue.listRecords(**{'set': 'epoch:starozytnosc'}) - print records