1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from catalogue.test_utils import WLTestCase
6 from catalogue import models
7 from oai.handlers import *
8 from oaipmh.server import *
10 from oaipmh.metadata import MetadataRegistry
11 from lxml import etree
14 class BookMetadataTest(WLTestCase):
16 super(BookMetadataTest, self).setUp()
17 xml = path.join(path.dirname(__file__), 'files/lubie-kiedy-kobieta.xml')
18 self.book = models.Book.from_xml_file(xml)
20 xml = path.join(path.dirname(__file__), 'files/antygona.xml')
21 self.book2 = models.Book.from_xml_file(xml)
23 mr = MetadataRegistry()
24 self.catalogue = Catalogue(mr)
26 mr.registerWriter('oai_dc', oai_dc_writer)
27 nsmap = {'oai_dc': NS_OAIDC, 'dc': NS_DC, 'xsi': NS_XSI}
28 self.xml = XMLTreeServer(self.catalogue, mr, nsmap)
30 def test_get_record(self):
31 self.xml.getRecord(identifier='lubie-kiedy-kobieta',
32 metadataPrefix='oai_dc')
33 self.xml.listRecords(metadataPrefix='oai_dc')
35 def test_selecting(self):
36 records, token = self.catalogue.listRecords(**{'set': 'epoch:starozytnosc'})