Changeset 8494 for main/waeup.kofa


Ignore:
Timestamp:
23 May 2012, 06:36:40 (12 years ago)
Author:
Henrik Bettermann
Message:

Fix exporter tests.

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

Legend:

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

    r8338 r8494  
    4242
    4343    def getStudent(self):
    44         return self.__parent__.__parent__
     44        return getattr(getattr(self, '__parent__', None), '__parent__', None)
    4545
    4646    @property
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r8429 r8494  
    4141        exporter.export([self.student], self.outfile)
    4242        result = open(self.outfile, 'rb').read()
    43         self.assertEqual(
    44             result,
     43        self.assertTrue(
    4544            'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
    4645            'firstname,lastname,matric_number,middlename,nationality,'
    47             'perm_address,phone,reg_number,sex,student_id\r\n'
    48 
    49             'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,Anna,'
    50             'Tester,M123456,M.,NG,"Studentroad 21\nLagos 123456\n",'
    51             '+234-123-12345,123456,f,A111111\r\n'
     46            'perm_address,phone,reg_number,sex,student_id,password,'
     47            'state,history,certcode\r\n'
     48
     49            'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,'
     50            'Anna,Tester,M123456,M.,NG,"Studentroad 21\nLagos 123456\n",'
     51            '+234-123-12345,123456,f,A111111,,created'
     52            in result
    5253            )
    5354        return
     
    6061        exporter.export_all(self.app, self.outfile)
    6162        result = open(self.outfile, 'rb').read()
    62         self.assertEqual(
    63             result,
     63        self.assertTrue(
    6464            'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
    6565            'firstname,lastname,matric_number,middlename,nationality,'
    66             'perm_address,phone,reg_number,sex,student_id\r\n'
    67 
    68             'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,Anna,'
    69             'Tester,M123456,M.,NG,"Studentroad 21\nLagos 123456\n",'
    70             '+234-123-12345,123456,f,A111111\r\n'
     66            'perm_address,phone,reg_number,sex,student_id,password,'
     67            'state,history,certcode\r\n'
     68
     69            'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,'
     70            'Anna,Tester,M123456,M.,NG,"Studentroad 21\nLagos 123456\n",'
     71            '+234-123-12345,123456,f,A111111,,created'
     72            in result
    7173            )
    7274        return
     
    7880        exporter.export_student(self.student, self.outfile)
    7981        result = open(self.outfile, 'rb').read()
    80         self.assertEqual(
    81             result,
     82        self.assertTrue(
    8283            'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
    8384            'firstname,lastname,matric_number,middlename,nationality,'
    84             'perm_address,phone,reg_number,sex,student_id\r\n'
    85 
    86             'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,Anna,'
    87             'Tester,M123456,M.,NG,"Studentroad 21\nLagos 123456\n",'
    88             '+234-123-12345,123456,f,A111111\r\n'
     85            'perm_address,phone,reg_number,sex,student_id,password,'
     86            'state,history,certcode\r\n'
     87
     88            'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,'
     89            'Anna,Tester,M123456,M.,NG,"Studentroad 21\nLagos 123456\n",'
     90            '+234-123-12345,123456,f,A111111,,created'
     91            in result
    8992            )
    9093        return
     
    122125            result,
    123126            'certificate,current_level,current_session,current_verdict,'
    124             'entry_mode,entry_session,previous_verdict\r\n'
    125 
    126             ',,,0,,,0\r\n'
     127            'entry_mode,entry_session,previous_verdict,student_id\r\n'
     128
     129            ',,,0,,,0,\r\n'
    127130            )
    128131        return
     
    139142            result,
    140143            'certificate,current_level,current_session,current_verdict,'
    141             'entry_mode,entry_session,previous_verdict\r\n'
    142 
    143             'CERT1,200,2012,0,ug_ft,2010,0\r\n'
     144            'entry_mode,entry_session,previous_verdict,student_id\r\n'
     145
     146            'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n'
    144147            )
    145148        return
     
    155158            result,
    156159            'certificate,current_level,current_session,current_verdict,'
    157             'entry_mode,entry_session,previous_verdict\r\n'
    158 
    159             'CERT1,200,2012,0,ug_ft,2010,0\r\n'
     160            'entry_mode,entry_session,previous_verdict,student_id\r\n'
     161
     162            'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n'
    160163            )
    161164        return
     
    170173            result,
    171174            'certificate,current_level,current_session,current_verdict,'
    172             'entry_mode,entry_session,previous_verdict\r\n'
    173 
    174             'CERT1,200,2012,0,ug_ft,2010,0\r\n'
     175            'entry_mode,entry_session,previous_verdict,student_id\r\n'
     176
     177            'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n'
    175178            )
    176179        return
     
    206209        self.assertEqual(
    207210            result,
    208             'level,level_session,level_verdict,matric_number,reg_number\r\n'
    209             ',,0,,\r\n'
     211            'level,level_session,level_verdict,student_id\r\n'
     212            ',,0,\r\n'
    210213            )
    211214        return
     
    222225        self.assertEqual(
    223226            result,
    224             'level,level_session,level_verdict,matric_number,reg_number\r\n'
    225             '100,2012,A,M123456,123456\r\n'
     227            'level,level_session,level_verdict,student_id\r\n'
     228            '100,2012,A,A111111\r\n'
    226229            )
    227230        return
     
    236239        self.assertEqual(
    237240            result,
    238             'level,level_session,level_verdict,matric_number,reg_number\r\n'
    239             '100,2012,A,M123456,123456\r\n'
     241            'level,level_session,level_verdict,student_id\r\n'
     242            '100,2012,A,A111111\r\n'
    240243            )
    241244        return
     
    249252        self.assertEqual(
    250253            result,
    251             'level,level_session,level_verdict,matric_number,reg_number\r\n'
    252             '100,2012,A,M123456,123456\r\n'
     254            'level,level_session,level_verdict,student_id\r\n'
     255            '100,2012,A,A111111\r\n'
    253256            )
    254257        return
     
    285288            result,
    286289            'automatic,carry_over,code,credits,dcode,fcode,level,mandatory,'
    287             'matric_number,passmark,reg_number,score,semester,title\r\n'
    288             '0,0,,,,,,0,,,,0,,\r\n'
     290            'passmark,score,semester,title,student_id\r\n'
     291            '0,0,,,,,,0,,0,,,\r\n'
    289292            )
    290293        return
     
    303306            result,
    304307            'automatic,carry_over,code,credits,dcode,fcode,level,mandatory,'
    305             'matric_number,passmark,reg_number,score,semester,title\r\n'
    306             '1,1,CRS1,100,DEP1,FAC1,100,0,M123456,100,123456,0,2,Course 1\r\n'
     308            'passmark,score,semester,title,student_id\r\n'
     309            '1,1,CRS1,100,DEP1,FAC1,100,0,100,0,2,Course 1,A111111\r\n'
    307310            )
    308311        return
     
    318321            result,
    319322            'automatic,carry_over,code,credits,dcode,fcode,level,mandatory,'
    320             'matric_number,passmark,reg_number,score,semester,title\r\n'
    321             '1,1,CRS1,100,DEP1,FAC1,100,0,M123456,100,123456,0,2,Course 1\r\n'
     323            'passmark,score,semester,title,student_id\r\n'
     324            '1,1,CRS1,100,DEP1,FAC1,100,0,100,0,2,Course 1,A111111\r\n'
    322325            )
    323326        return
     
    332335            result,
    333336            'automatic,carry_over,code,credits,dcode,fcode,level,mandatory,'
    334             'matric_number,passmark,reg_number,score,semester,title\r\n'
    335             '1,1,CRS1,100,DEP1,FAC1,100,0,M123456,100,123456,0,2,Course 1\r\n'
     337            'passmark,score,semester,title,student_id\r\n'
     338            '1,1,CRS1,100,DEP1,FAC1,100,0,100,0,2,Course 1,A111111\r\n'
    336339            )
    337340        return
     
    368371        self.assertEqual(
    369372            result,
    370             'ac,amount_auth,creation_date,matric_number,p_category,p_id,'
     373            'ac,amount_auth,creation_date,p_category,p_id,'
    371374            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    372             'r_code,r_desc,reg_number\r\n'
    373 
    374             ',0.0,2012-04-01 13:12:01,,schoolfee,,,,,unpaid,,0.0,,,\r\n'
     375            'r_code,r_desc,student_id\r\n'
     376
     377            ',0.0,2012-04-01 13:12:01,schoolfee,,,,,unpaid,,0.0,,,\r\n'
    375378            )
    376379        return
     
    386389        self.assertEqual(
    387390            result,
    388             'ac,amount_auth,creation_date,matric_number,p_category,p_id,'
     391            'ac,amount_auth,creation_date,p_category,p_id,'
    389392            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    390             'r_code,r_desc,reg_number\r\n'
    391 
    392             '666,0.0,2012-04-01 13:12:01,M123456,schoolfee,my-id,'
     393            'r_code,r_desc,student_id\r\n'
     394
     395            '666,0.0,2012-04-01 13:12:01,schoolfee,my-id,'
    393396            'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,'
    394             'r-code,,123456\r\n'
     397            'r-code,,A111111\r\n'
    395398            )
    396399        return
     
    405408        self.assertEqual(
    406409            result,
    407             'ac,amount_auth,creation_date,matric_number,p_category,p_id,'
     410            'ac,amount_auth,creation_date,p_category,p_id,'
    408411            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    409             'r_code,r_desc,reg_number\r\n'
    410 
    411             '666,0.0,2012-04-01 13:12:01,M123456,schoolfee,my-id,'
     412            'r_code,r_desc,student_id\r\n'
     413
     414            '666,0.0,2012-04-01 13:12:01,schoolfee,my-id,'
    412415            'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,'
    413             'r-code,,123456\r\n'
     416            'r-code,,A111111\r\n'
    414417            )
    415418        return
     
    424427        self.assertEqual(
    425428            result,
    426             'ac,amount_auth,creation_date,matric_number,p_category,p_id,'
     429            'ac,amount_auth,creation_date,p_category,p_id,'
    427430            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    428             'r_code,r_desc,reg_number\r\n'
    429 
    430             '666,0.0,2012-04-01 13:12:01,M123456,schoolfee,my-id,'
     431            'r_code,r_desc,student_id\r\n'
     432
     433            '666,0.0,2012-04-01 13:12:01,schoolfee,my-id,'
    431434            'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,'
    432             'r-code,,123456\r\n'
    433             )
    434         return
     435            'r-code,,A111111\r\n'
     436            )
     437        return
Note: See TracChangeset for help on using the changeset viewer.