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
13 class BookMetadataTest(WLTestCase):
15 super(BookMetadataTest, self).setUp()
16 xml = path.join(path.dirname(__file__), 'files/lubie-kiedy-kobieta.xml')
17 self.book = models.Book.from_xml_file(xml)
19 xml = path.join(path.dirname(__file__), 'files/antygona.xml')
20 self.book2 = models.Book.from_xml_file(xml)
22 mr = MetadataRegistry()
23 self.catalogue = Catalogue(mr)
25 mr.registerWriter('oai_dc', oai_dc_writer)
26 nsmap = {'oai_dc': NS_OAIDC, 'dc': NS_DC, 'xsi': NS_XSI}
27 self.xml = XMLTreeServer(self.catalogue, mr, nsmap)
29 # def test_get_record(self):
30 # self.xml.getRecord(identifier='lubie-kiedy-kobieta', metadataPrefix='oai_dc')
31 # self.xml.listRecords(metadataPrefix='oai_dc')
33 # def test_selecting(self):
34 # records, token = self.catalogue.listRecords(**{'set': 'epoch:starozytnosc'})