示例#1
0
 def test_convert(self):
     """Test converting xls files to csv"""
     convert(self.metadata)
     for f in self.studentcsv:
         assert os.path.isfile(f)
     for f in self.barcodecsv:
         assert os.path.isfile(f)
示例#2
0
 def run(self, ptype=None):
     """Create/Update student records from csv files"""
     # We need to clear out ProtoStudent and ProtoBarcode
     self._delete_proto()
     convert(self.metadata)
     sis_import.do_barcodes(self.barcodecsv)
     sis_import.do_students(self.studentcsv)
     sis_import.normalize_students()
     sis_import.write_marc(self.outfile, ptype=ptype)
     return 0
示例#3
0
 def run(self, ptype=None):
     """Create/Update student records from csv files"""
     # We need to clear out ProtoStudent and ProtoBarcode
     self._delete_proto()
     convert(self.metadata)
     sis_import.do_barcodes(self.barcodecsv)
     sis_import.do_students(self.studentcsv)
     sis_import.normalize_students()
     sis_import.write_marc(self.outfile, ptype=ptype)
     return 0
示例#4
0
 def test_create_student_recs_uow(self):
     """Test generating student records from csv files (uow patron type only)"""
     convert(self.metadata)
     sis_import.do_barcodes(self.barcodecsv)
     assert len(ProtoBarcode.objects.all())
     uowcsvf = os.path.join(student_dir,'uow.csv')
     sis_import.do_students([uowcsvf])
     assert len(ProtoStudent.objects.all())
     sis_import.normalize_students()
     # compare ptype from csv to ptype in ProtoStudent
     ptype = sis_import.get_ptype_for_file('uow.csv')
     uowcsv = csvreader(open(uowcsvf))
     for row in uowcsv:
         if not student_id_pattern.match(row[0]):
             continue
         ps = ProtoStudent.objects.filter(student_id=row[0])[0]
         assert ps.ptype == ptype
     # check that records from ProtoStudent have the same ptype as
     # the corresponding record in Student
     uow = ProtoStudent.objects.filter(ptype=ptype)
     for r in uow:
         s = Student.objects.get(student_id=r.student_id)
         assert s.ptype == ptype 
     sis_import.write_marc('/tmp/testdata.lfts')