Пример #1
0
def import_xcri_ox(force_update=False):
    app = create_app()
    url = app.config['XCRI_IMPORT_URL']
    with app.blueprint_context(BLUEPRINT_NAME):
        xcri = get_resource(url, force_update)
        xcri_importer = XcriOxImporter(searcher, xcri, timeout=600)
        xcri_importer.run()
Пример #2
0
    def test_importer(self):
        importer = XcriOxImporter(self.mock_index, open(self.xcri_path))
        importer.run()
        presentations = importer.presentations

        first = presentations[0]
        self.assertEqual(first['provider_title'], "Humanities Division")
        self.assertEqual(first['course_title'], "Monograph Publishing Workshop")
        self.assertEqual(len(first['course_subject']), 0)
        self.assertEqual(first['presentation_start'], "2012-06-15T00:00:00Z")
        self.assertEqual(first['presentation_bookingEndpoint'], "https://weblearn.ox.ac.uk/course-signup/rest/course/5E00D50013")
        self.assertEqual(first['presentation_attendancePattern'], "Daytime")
        self.assertEqual(first['presentation_venue_identifier'], "oxpoints:ABCD")
        self.assertEqual(first['presentation_memberApplyTo'], "http://courses.it.ox.ac.uk/detail/TRWF")

        third = presentations[2]
        self.assertEqual(third['presentation_venue_identifier'], "oxpoints:FFFF")

        last = presentations[3]
        self.assertEqual(last['presentation_identifier'], "daisy-presentation-19303")
        self.assertEqual(last['presentation_start'], "2012-05-24T00:00:00Z")
        self.assertEqual(last['presentation_end'], "2012-05-24T00:00:00Z")
        self.assertEqual(last['presentation_applyFrom'], "2012-04-19T00:00:00Z")
        self.assertEqual(last['presentation_applyUntil'], "2012-05-14T00:00:00Z")
        self.assertEqual(last['course_title'], "Lunchtime Briefings on the Digital Humanities")
        self.assertEqual(last['provider_title'], "Digital Humanities Division")
        self.assertEqual(last['presentation_memberApplyTo'], "http://courses.it.ox.ac.uk/detail/TRWF")
        self.assertEqual(len(last['course_subject']), 1)
Пример #3
0
 def test_importer_get_identifier(self):
     self.assertEqual(XcriOxImporter._get_identifier(['ABCD', 'https://course.data.ox.ac.uk/id/itlp/presentation/TDAE-106830']),
         "itlp-presentation-TDAE-106830")
     self.assertEqual(XcriOxImporter._get_identifier(['ABCD', '12',
                                                      'https://course.data.ox.ac.uk/id/daisy/presentation/14941']),
         'daisy-presentation-14941')
Пример #4
0
 def test_importer_date_to_solr_format(self):
     self.assertEqual(XcriOxImporter._date_to_solr_format("2012-01-01"),
         "2012-01-01T00:00:00Z")
     self.assertEqual(XcriOxImporter._date_to_solr_format("2012-12-31"),
         "2012-12-31T00:00:00Z")