Ignore:
Timestamp:
19 Apr 2012, 06:02:16 (13 years ago)
Author:
Henrik Bettermann
Message:

Add first test to ensure that attributes are not cleared if cells are empty and that attributes are cleared if cells contain the deletion marker 'XXX'.

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

    r7983 r8210  
    11student_id,firstname,lastname,reg_number,date_of_birth,matric_number,email,phone,sex,reg_state
    22X666666,Aaren,Pieri,1,1990-01-02,100000,aa@aa.ng,1234,m,courses validated
    3 ,Aaren,Finau,2,1990-01-03,100001,aa@aa.ng,1234,m,courses validated
    4 ,Aaren,Berson,3,1990-01-04,100002,aa@aa.ng,1234,m,courses validated
     3,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
    55,Else,Mueller,4,1990-01-05,100003,aa@aa.ng,1234,f,courses registered
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_update2.csv

    r6850 r8210  
    1 date_of_birth,matric_number
    2 1970-01-02,100000
    3 1970-01-03,100001
    4 1970-01-04,100002
     1date_of_birth,matric_number,phone
     21970-01-02,100000,
     31970-01-03,100001,XXX
     41970-01-04,100002,
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r8200 r8210  
    261261            self.csv_file_update2, STUDENT_HEADER_FIELDS_UPDATE2, 'update')
    262262        self.assertEqual(num_warns,0)
     263        # The phone import value of Pieri was None.
     264        # Confirm that phone has not been cleared.
     265        container = self.app['students']
     266        for key in container.keys():
     267            if container[key].firstname == 'Aaren':
     268                aaren = container[key]
     269                break
     270        self.assertEqual(aaren.phone, '--1234')
     271        # The phone import value of Claus was a deletion marker.
     272        # Confirm that phone has been cleared.
     273        for key in container.keys():
     274            if container[key].firstname == 'Claus':
     275                claus = container[key]
     276                break
     277        assert claus.phone is None
    263278        shutil.rmtree(os.path.dirname(fin_file))
    264279
Note: See TracChangeset for help on using the changeset viewer.