Changeset 7952


Ignore:
Timestamp:
22 Mar 2012, 07:46:43 (13 years ago)
Author:
Henrik Bettermann
Message:

Improve tests (and remove bugs found by testing).

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

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py

    r7951 r7952  
    681681        for key, value in row.items():
    682682            # Skip fields not declared in interface plus
    683             # current_verdict and current_level
     683            # current_session and current_level
    684684            if hasattr(obj, key) and not key in [
    685                 'current_verdict','current_level']:
     685                'current_session','current_level']:
    686686                setattr(obj, key, value)
    687687            items_changed += '%s=%s, ' % (key,value)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data.csv

    r7951 r7952  
    33,Aaren,Finau,2,1990-01-03,100001,aa@aa.ng,1234,courses validated
    44,Aaren,Berson,3,1990-01-04,100002,aa@aa.ng,1234,courses validated
     5,Else,Mueller,4,1990-01-05,100003,aa@aa.ng,1234,courses registered
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_verdict_data.csv

    r7951 r7952  
    11matric_number,current_session,current_level,current_verdict
    22100000,2008,200,A
    3 100001,2008,200,B
    4 100002,2008,200,C
     3100001,2008,100,B
     4100002,2007,200,C
     5100003,2008,200,A
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r7951 r7952  
    241241            self.csv_file, STUDENT_HEADER_FIELDS)
    242242        self.assertEqual(num_warns,0)
    243         assert len(self.app['students'].keys()) == 4
     243        assert len(self.app['students'].keys()) == 5
    244244        self.assertEqual(self.app['students']['X666666'].reg_number,'1')
    245245        shutil.rmtree(os.path.dirname(fin_file))
     
    383383        num, num_warns, fin_file, fail_file = self.processor.doImport(
    384384            self.csv_file, VERDICT_HEADER_FIELDS,'update')
    385         self.assertEqual(num_warns,0)
    386         studycourse = self.processor.getEntry(dict(reg_number='1'), self.app)
    387         self.assertEqual(studycourse.certificate.code, u'CERT1')
     385        self.assertEqual(num_warns,3)
     386        studycourse = self.processor.getEntry(dict(matric_number='100000'), self.app)
     387        student = self.processor.getParent(dict(matric_number='100000'), self.app)
     388        self.assertEqual(studycourse.current_verdict, 'A')
     389        self.assertEqual(student.state, 'returning')
    388390        shutil.rmtree(os.path.dirname(fin_file))
    389391
Note: See TracChangeset for help on using the changeset viewer.