Ignore:
Timestamp:
16 Jun 2014, 08:29:22 (10 years ago)
Author:
Henrik Bettermann
Message:

Remove dependencies on kofacustom.nigeria.

Location:
main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/tests/test_browser.py

    r11543 r11687  
    2424from zope.catalog.interfaces import ICatalog
    2525from zope.intid.interfaces import IIntIds
    26 from kofacustom.skeleton.testing import FunctionalLayer
     26from kofacustom.sampleuni.testing import FunctionalLayer
     27from waeup.kofa.schoolgrades import ResultEntry
     28from waeup.kofa.utils.utils import KofaUtils
    2729from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup
    2830from waeup.kofa.applicants.tests.test_batching import ApplicantImportExportSetup
    29 from kofacustom.skeleton.applicants.export import CustomApplicantsExporter
    30 from kofacustom.skeleton.applicants.batching import CustomApplicantProcessor
     31from kofacustom.sampleuni.applicants.export import CustomApplicantsExporter
     32from kofacustom.sampleuni.applicants.batching import CustomApplicantProcessor
    3133
    3234class CustomApplicantUITests(ApplicantsFullSetup):
     
    5355        applicant.lastname = u'Tester'
    5456        applicant.middlename = u'M.'
    55         applicant.nationality = u'NG'
    5657        applicant.date_of_birth = datetime.date(1981, 2, 4)
    5758        applicant.sex = 'f'
     
    6263        applicant.course_admitted = self.certificate
    6364        applicant.notice = u'Some notice\nin lines.'
    64         applicant.screening_score = 98
    65         applicant.screening_venue = u'Exam Room'
    66         applicant.screening_date = u'Saturday, 16th June 2012 2:00:00 PM'
    6765        applicant.password = 'any password'
     66        result_entry = ResultEntry(
     67            KofaUtils.EXAM_SUBJECTS_DICT.keys()[0],
     68            KofaUtils.EXAM_GRADES[0][0]
     69            )
     70        applicant.school_grades = [
     71            result_entry]
    6872        return applicant
    6973
     
    7579        exporter.export_all(self.app, self.outfile)
    7680        result = open(self.outfile, 'rb').read()
    77         self.assertMatches(result,
    78             'aggregate,applicant_id,application_date,application_number,'
    79             'course1,course2,course_admitted,date_of_birth,display_fullname,'
    80             'email,emp2_end,emp2_position,emp2_reason,emp2_start,emp_end,'
    81             'emp_position,emp_reason,emp_start,employer,employer2,'
    82             'firstname,history,hq_degree,hq_disc,hq_matric_no,hq_school,'
    83             'hq_session,hq_type,jamb_score,jamb_subjects,lastname,lga,'
    84             'locked,middlename,nationality,notice,nysc_lga,nysc_year,'
    85             'password,phone,pp_school,presently_inst,reg_number,'
    86             'result_uploaded,screening_date,screening_score,'
    87             'screening_venue,sex,special_application,'
    88             'state,student_id,suspended,container_code\r\n'
    89             ',dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,'
    90             'Anna M. Tester,anna@sample.com,,,,,,,,,,,Anna,'
    91             '[u\'2012-10-28 21:27:52 WAT - Application initialized by system\']'
    92             ',,,,,,,,,Tester,,0,M.,NG,"Some notice\nin lines.",,,'
    93             'any password,+234-123-12345#,,,123456,,'
    94             '"Saturday, 16th June 2012 2:00:00 PM",98,Exam Room,f,,initialized,,'
    95             '0,dp2011\r\n')
     81        self.assertTrue(
     82            'applicant_id,application_date,application_number,course1,course2,'
     83            'course_admitted,date_of_birth,display_fullname,email,firstname,'
     84            'history,lastname,locked,middlename,notice,password,phone,'
     85            'reg_number,sex,special_application,state,'
     86            'student_id,suspended,container_code\r\n'
     87            'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,'
     88            'Anna M. Tester,anna@sample.com,Anna,'
     89            in result)
     90        self.assertTrue(
     91            'Application initialized by system\'],'
     92            'Tester,0,M.,"Some notice\nin lines.",any password,'
     93            '+234-123-12345#,123456,f,,initialized,,0,dp2011\r\n'
     94            in result)
    9695        # We can import the same file if we ignore some columns.
    9796        # Since the applicants_catalog hasn't been notified, the same
     
    10099        result = processor.doImport(
    101100            self.outfile,
    102             ['aggreagate','ignore_applicant_id','application_date',
     101            ['ignore_applicant_id','application_date',
    103102            'ignore_application_number','course1','course2',
    104             'course_admitted','date_of_birth','ignore3','email','emp2_end',
    105             'emp2_position','emp2_reason','emp2_start','emp_end','emp_position',
    106             'emp_reason','emp_start','employer','employer2','firstname','ignore4',
    107             'hq_degree','hq_disc','hq_matric_no','hq_school','hq_session','hq_type',
    108             'jamb_score','jamb_subjects','lastname','lga','locked','middlename',
    109             'nationality','notice','nysc_lga',
    110             'nysc_year','password','phone','pp_school','presently_inst',
    111             'reg_number','result_uploaded',
    112             'screening_date','screening_score','screening_venue','sex',
    113             'special_application',
    114             'state','student_id','suspended','container_code'],
     103            'course_admitted','date_of_birth',
     104            'ignore_display_fullname','email','firstname',
     105            'ignore_history','lastname','locked','middlename',
     106            'notice','password','phone',
     107            'reg_number','sex','special_application','state',
     108            'student_id','suspended','container_code'],
    115109            mode='create')
    116110        num_succ, num_fail, finished_path, failed_path = result
     
    118112        self.assertEqual(num_succ,1)
    119113        self.assertEqual(num_fail,0)
    120         # Now we ignore also the container_code and import the same file
    121         # in update mode which means that INigeriaApplicantUpdateByRegNo
    122         # is used for field conversion. applicant_id must be ignored
    123         # too since the previous import has notified the applicants_catalog
    124         # so that the portal 'knows' that reg_number is in use.
    125         processor = CustomApplicantProcessor()
    126         result = processor.doImport(
    127             self.outfile,
    128             ['aggregate','ignore_applicant_id','application_date',
    129             'ignore_application_number','course1','course2',
    130             'course_admitted','date_of_birth','ignore3','email','emp2_end',
    131             'emp2_position','emp2_reason','emp2_start','emp_end','emp_position',
    132             'emp_reason','emp_start','employer','employer2','firstname','ignore4',
    133             'hq_degree','hq_disc','hq_matric_no','hq_school','hq_session','hq_type',
    134             'jamb_score','jamb_subjects','lastname','lga','locked','middlename',
    135             'nationality','notice','nysc_lga',
    136             'nysc_year','password','phone','pp_school','presently_inst',
    137             'reg_number','result_uploaded','screening_date','screening_score',
    138             'screening_venue','sex','special_application',
    139             'state','student_id','suspended','ignore_container_code'],
    140             mode='update')
    141         num_succ, num_fail, finished_path, failed_path = result
    142         self.assertEqual(num_succ,1)
    143         self.assertEqual(num_fail,0)
    144114        return
Note: See TracChangeset for help on using the changeset viewer.