Ignore:
Timestamp:
21 Feb 2022, 09:39:05 (3 years ago)
Author:
Henrik Bettermann
Message:

Enable import of student history.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students/tests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data.csv

    r15628 r16819  
    1 student_id,firstname,lastname,reg_number,date_of_birth,matric_number,email,phone,sex,state,password
    2 X666666,Aaren,Pieri,1,1990-01-02,100000,,1234,M,courses validated,test1234
    3 Y777777,Claus,Finau,2,1990-01-03,100001,aa@aa.ng,1234,m,courses validated,
    4 ,Susann,Berson,3,1990-01-04,100002,aa@aa.ng,1234,F,courses validated,
    5 ,Else,Mueller,4,1990-01-05,100003,aa@aa.ng,1234,f,school fee paid,
    6 ,,,,,,,,,,
    7 ,,,,  ,,, ,,,
    8 ,,,,<IGNORE>,,,<IGNORE>,,,
    9 X888888,Alfons,Meier,5,1990-01-02,100004,aa@aa.ng,1234,m,courses validated,
    10 X999999,Herbert,Mueller,6,1990-01-02,100005,aa@aa.ng,1234,m,courses registered,
    11 X111111,Fabian,Riester,7,1990-01-02,100006,aa@aa.ng,1234,m,courses validated,
    12 X222222,Thomas,Kinderman,8,1990-01-02,100007,aa@aa.ng,1234,m,courses validated,
    13 X333333,Paula,Schall,9,1990-01-02,100008,aa@aa.ng,1234,m,courses registered,
     1student_id,firstname,lastname,reg_number,date_of_birth,matric_number,email,phone,sex,state,password,history
     2X666666,Aaren,Pieri,1,1990-01-02,100000,,1234,M,courses validated,test1234,"[u'2012-10-23 00:05:39 WAT - Record created by System Admin', u'2012-10-23 00:05:39 WAT - Admitted by System Admin',u""2021-02-21 12:49:12 WAT - State 'graduated' set by System Admin""]"
     3Y777777,Claus,Finau,2,1990-01-03,100001,aa@aa.ng,1234,m,courses validated,,
     4,Susann,Berson,3,1990-01-04,100002,aa@aa.ng,1234,F,courses validated,,
     5,Else,Mueller,4,1990-01-05,100003,aa@aa.ng,1234,f,school fee paid,,
     6,,,,,,,,,,,
     7,,,,  ,,, ,,,,
     8,,,,<IGNORE>,,,<IGNORE>,,,,
     9X888888,Alfons,Meier,5,1990-01-02,100004,aa@aa.ng,1234,m,courses validated,,
     10X999999,Herbert,Mueller,6,1990-01-02,100005,aa@aa.ng,1234,m,courses registered,,
     11X111111,Fabian,Riester,7,1990-01-02,100006,aa@aa.ng,1234,m,courses validated,,
     12X222222,Thomas,Kinderman,8,1990-01-02,100007,aa@aa.ng,1234,m,courses validated,,
     13X333333,Paula,Schall,9,1990-01-02,100008,aa@aa.ng,1234,m,courses registered,,
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_migration.csv

    r8355 r16819  
    1 student_id,firstname,lastname,reg_number,date_of_birth,matric_number,email,phone,password,sex,state
    2 A123456,Aaren,Pieri,1,1990-01-02#,100000,aa@aa.ng,1234,mypw1,m,clearance started
    3 B123456,Aaren,Finau,2,1990-01-03,100001,aa@aa.ng,1234,mypw1,m,cleared
    4 C123456,Aaren,Berson,3,1990-01-04,100002,aa@aa.ng,1234,{SSHA}JJBeA47pgGah500NFpuM2tVeLAbM8dxj,m,admitted
    5 D123456,John,Wolter,4,1990-01-05,100003,aa@aa.ng,1234,mypw1,m,nonsense
    6 E123456,John,Kennedy,5,1990-01-06,100004,aa@aa.ng,1234,,x,
    7 F123456,Frank,Meyer,6,1990-01-06,100005,aa@aa.ng,1234,,m,
     1student_id,firstname,lastname,reg_number,date_of_birth,matric_number,email,phone,password,sex,state,history
     2A123456,Aaren,Pieri,1,1990-01-02#,100000,aa@aa.ng,1234,mypw1,m,clearance started,"[u'2012-10-23 00:05:39 WAT - Record created by System Admin', u'2012-10-23 00:05:39 WAT - Admitted by System Admin',u""2021-02-21 12:49:12 WAT - State 'graduated' set by System Admin""]"
     3B123456,Aaren,Finau,2,1990-01-03,100001,aa@aa.ng,1234,mypw1,m,cleared,
     4C123456,Aaren,Berson,3,1990-01-04,100002,aa@aa.ng,1234,{SSHA}JJBeA47pgGah500NFpuM2tVeLAbM8dxj,m,admitted,
     5D123456,John,Wolter,4,1990-01-05,100003,aa@aa.ng,1234,mypw1,m,nonsense,
     6E123456,John,Kennedy,5,1990-01-06,100004,aa@aa.ng,1234,,x,,
     7F123456,Frank,Meyer,6,1990-01-06,100005,aa@aa.ng,1234,,m,,
     8G123456,Ulli,Meyer,7,1990-01-06,100007,aa@aa.ng,1234,,m,,nonsense
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r16812 r16819  
    420420        self.assertEqual(
    421421            self.app['students']['X666666'].state, 'courses validated')
     422        # history was successfully impotrted
     423        history = self.app['students']['X666666'].history.messages
     424        self.assertEqual(history[0],
     425            '2012-10-23 00:05:39 WAT - Record created by System Admin')
     426        self.assertTrue(
     427            "State 'courses validated' imported by system" in history[3])
     428        # history import has been logged
     429        logcontent = open(self.logfile).read()
     430        self.assertTrue(
     431            "history=[u'2012-10-23 00:05:39 WAT - Record created by System Admin'"
     432            in logcontent)
    422433        # Two new student_ids have been created.
    423434        self.assertEqual(self.app['students']._curr_stud_id, 1000003)
     
    514525            self.csv_file_migration, STUDENT_HEADER_FIELDS_MIGRATION)
    515526        content = open(fail_file).read()
    516         self.assertEqual(num_warns,2)
     527        self.assertEqual(num_warns,3)
    517528        assert len(self.app['students'].keys()) == 5
    518529        self.assertEqual(
    519530            content,
    520             'reg_number,firstname,student_id,sex,email,phone,state,date_of_birth,lastname,password,matric_number,--ERRORS--\r\n'
    521             '4,John,D123456,m,aa@aa.ng,1234,nonsense,1990-01-05,Wolter,mypw1,100003,state: not allowed\r\n'
    522             '5,John,E123456,x,aa@aa.ng,1234,<IGNORE>,1990-01-06,Kennedy,<IGNORE>,100004,sex: Invalid value\r\n'
     531            'reg_number,firstname,student_id,sex,email,phone,state,date_of_birth,lastname,password,matric_number,history,--ERRORS--\r\n'
     532            '4,John,D123456,m,aa@aa.ng,1234,nonsense,1990-01-05,Wolter,mypw1,100003,<IGNORE>,state: not allowed\r\n'
     533            '5,John,E123456,x,aa@aa.ng,1234,<IGNORE>,1990-01-06,Kennedy,<IGNORE>,100004,<IGNORE>,sex: Invalid value\r\n'
     534            '7,Ulli,G123456,m,aa@aa.ng,1234,<IGNORE>,1990-01-06,Meyer,<IGNORE>,100007,nonsense,history: malformed string\r\n'
    523535            )
    524536        students = self.app['students']
     
    532544                         datetime.date(1990, 1, 3))
    533545        self.assertTrue(students['B123456'].clearance_locked)
    534         history = ' '.join(students['A123456'].history.messages)
     546        history = students['A123456'].history.messages
     547        self.assertEqual(history[0],
     548            '2012-10-23 00:05:39 WAT - Record created by System Admin')
    535549        self.assertTrue(
    536             "State 'clearance started' set by system" in history)
     550            "State 'clearance started' imported by system" in history[3])
    537551        # state was empty and student is thus in state created
    538552        self.assertEqual(students['F123456'].state,'created')
     
    723737        self.assertEqual(self.student.current_mode, 'ug_pt')
    724738        shutil.rmtree(os.path.dirname(fin_file))
    725         # Transer has bee logged.
     739        # Transfer has bee logged.
    726740        logcontent = open(self.logfile).read()
    727741        self.assertTrue(
Note: See TracChangeset for help on using the changeset viewer.