X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/a33d4ff020fa16e0359991023a2cd031831e9ec4..ce8bb4b693d45e5e33f94cbf5fb381acb8d593ad:/apps/oai/tests/oaipmhapi.py diff --git a/apps/oai/tests/oaipmhapi.py b/apps/oai/tests/oaipmhapi.py index ae5e543d7..6ef3b096c 100644 --- a/apps/oai/tests/oaipmhapi.py +++ b/apps/oai/tests/oaipmhapi.py @@ -1,20 +1,34 @@ -import sys -print sys.path 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 -from oai.handlers import Catalogue +from oaipmh.metadata import MetadataRegistry +from lxml import etree + class BookMetadataTest(WLTestCase): def setUp(self): - super(BookMetadata, self).setUp() + super(BookMetadataTest, self).setUp() xml = path.join(path.dirname(__file__), 'files/lubie-kiedy-kobieta.xml') self.book = models.Book.from_xml_file(xml) + + xml = path.join(path.dirname(__file__), 'files/antygona.xml') + self.book2 = models.Book.from_xml_file(xml) + self.catalogue = Catalogue() + mr = MetadataRegistry() + 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): - r = self.catalogue.getRecord(record='lubie-kiedy-kobieta') - print r + sch = self.xml.getRecord(identifier='lubie-kiedy-kobieta', + metadataPrefix='oai_dc') + sch = self.xml.listRecords(metadataPrefix='oai_dc') + + def test_selecting(self): + records, token = self.catalogue.listRecords(**{'set': 'epoch:starozytnosc'})