Changeset 13985 for main/kofacustom.wdu


Ignore:
Timestamp:
23 Jun 2016, 11:26:45 (8 years ago)
Author:
Henrik Bettermann
Message:

Do not export all attributes.

Location:
main/kofacustom.wdu/trunk/src/kofacustom/wdu/applicants
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.wdu/trunk/src/kofacustom/wdu/applicants/export.py

    r13097 r13985  
    2020import grok
    2121from waeup.kofa.applicants.interfaces import IApplicantBaseData
     22from waeup.kofa.utils.helpers import iface_names
    2223from kofacustom.nigeria.applicants.export import NigeriaApplicantExporter
    2324from kofacustom.nigeria.applicants.interfaces import (
     
    3132
    3233    fields = tuple(sorted(set(
    33         ICustomUGApplicant.names() +
    34         ICustomPGApplicant.names() +
    35         #INigeriaUGApplicant.names() +
    36         INigeriaPGApplicant.names() +
    37         IApplicantBaseData.names()
    38         )))
     34        iface_names(ICustomUGApplicant) +
     35        iface_names(ICustomPGApplicant) +
     36        #iface_names(INigeriaUGApplicant) +
     37        iface_names(INigeriaPGApplicant) +
     38        iface_names(IApplicantBaseData)
     39        ))) + (
     40        'password', 'state', 'history', 'container_code', 'application_number',
     41        'display_fullname', 'application_date')
  • main/kofacustom.wdu/trunk/src/kofacustom/wdu/applicants/tests/test_browser.py

    r13593 r13985  
    7070        return applicant
    7171
    72     def test_export_reimport_all(self):
    73         # we can export all applicants in a portal
    74         # set values we can expect in export file
    75         self.applicant = self.setup_applicant(self.applicant)
    76         exporter = CustomApplicantExporter()
    77         exporter.export_all(self.app, self.outfile)
    78         result = open(self.outfile, 'rb').read()
    79         self.assertMatches(result,
    80             'aggregate,applicant_id,application_date,application_number,'
    81             'body_responsible_address,container_code,course1,course2,'
    82             'course_admitted,date_of_birth,display_fullname,email,emp2_end,'
    83             'emp2_position,emp2_reason,emp2_start,emp_end,emp_position,'
    84             'emp_reason,emp_start,employer,employer2,firstname,fst_sit_date,'
    85             'fst_sit_fname,fst_sit_no,fst_sit_results,fst_sit_type,history,'
    86             'hq_degree,hq_disc,hq_fname,hq_matric_no,hq_school,hq_session,'
    87             'hq_type,jamb_reg_number,jamb_score,jamb_subjects,lastname,'
    88             'lga,locked,marit_stat,middlename,nationality,next_kin_address,'
    89             'notice,nysc_lga,nysc_year,olevel_exam_date,olevel_exam_date2,'
    90             'olevel_exam_number,olevel_exam_number2,olevel_results,'
    91             'olevel_results2,olevel_school,olevel_school2,olevel_type,'
    92             'olevel_type2,password,phone,presently_inst,reg_number,religion,'
    93             'result_uploaded,scd_sit_date,scd_sit_fname,scd_sit_no,'
    94             'scd_sit_results,scd_sit_type,screening_date,screening_score,'
    95             'screening_venue,sex,special,special_application,state,'
    96             'student_id,suspended,translated_state\r\n,'
    97             'dp2011_654321,,654321,,dp2011,CERT1,CERT1,CERT1,'
    98             '1981-02-04#,Anna M. Tester,anna@sample.com,,,,,,,,,,,Anna,,,,,,'
    99             '[u\'2016-01-11 10:28:58 WAT - Application initialized by system\']'
    100             ',,,,,,,,,,,Tester,,0,,M.,NG,,"Some notice\nin lines.",,,,,,,,,,,,,'
    101             'any password,+234-123-12345#,,123456,,,,,,,,'
    102             '"Saturday, 16th June 2012 2:00:00 PM",98,Exam Room,'
    103             'f,,,initialized,,0,initialized\r\n')
    104         # We can import the same file if we ignore some columns.
    105         # Since the applicants_catalog hasn't been notified, the same
    106         # record with same reg_number can be imported twice.
    107         processor = CustomApplicantProcessor()
    108         result = processor.doImport(
    109             self.outfile,
    110             ['aggregate','ignore_applicant_id','application_date','ignore_application_number',
    111             'body_responsible_address','container_code','course1','course2',
    112             'course_admitted','date_of_birth','ignore_display_fullname','email',
    113             'emp2_end','emp2_position','emp2_reason','emp2_start','emp_end',
    114             'emp_position','emp_reason','emp_start','employer','employer2',
    115             'firstname','fst_sit_date','fst_sit_fname','fst_sit_no',
    116             'fst_sit_results','fst_sit_type','ignore_history','hq_degree','hq_disc',
    117             'hq_fname','hq_matric_no','hq_school','hq_session','hq_type',
    118             'jamb_reg_number','jamb_score','jamb_subjects','lastname','lga',
    119             'locked','marit_stat','middlename','nationality','next_kin_address',
    120             'notice','nysc_lga','nysc_year','olevel_exam_date',
    121             'olevel_exam_date2','olevel_exam_number','olevel_exam_number2',
    122             'olevel_results','olevel_results2','olevel_school','olevel_school2',
    123             'olevel_type','olevel_type2','password','phone','presently_inst',
    124             'reg_number','religion','result_uploaded','scd_sit_date',
    125             'scd_sit_fname','scd_sit_no','scd_sit_results','scd_sit_type',
    126             'screening_date','screening_score','screening_venue','sex',
    127             'ignore_special','special_application','state','student_id',
    128             'suspended','ignore_translated_state'],
    129             mode='create')
    130         num_succ, num_fail, finished_path, failed_path = result
    131         self.assertEqual(num_succ,1)
    132         self.assertEqual(num_fail,0)
    133         # Now we ignore also the container_code and import the same file
    134         # in update mode which means that INigeriaApplicantUpdateByRegNo
    135         # is used for field conversion. applicant_id must be ignored
    136         # too since the previous import has notified the applicants_catalog
    137         # so that the portal 'knows' that reg_number is in use.
    138         processor = CustomApplicantProcessor()
    139         result = processor.doImport(
    140             self.outfile,
    141             ['aggregate','ignore_applicant_id','application_date','ignore_application_number',
    142             'body_responsible_address','ignore_container_code','course1','course2',
    143             'course_admitted','date_of_birth','ignore_display_fullname','email',
    144             'emp2_end','emp2_position','emp2_reason','emp2_start','emp_end',
    145             'emp_position','emp_reason','emp_start','employer','employer2',
    146             'firstname','fst_sit_date','fst_sit_fname','fst_sit_no',
    147             'fst_sit_results','fst_sit_type','ignore_history','hq_degree','hq_disc',
    148             'hq_fname','hq_matric_no','hq_school','hq_session','hq_type',
    149             'jamb_reg_number','jamb_score','jamb_subjects','lastname','lga',
    150             'locked','marit_stat','middlename','nationality','next_kin_address',
    151             'notice','nysc_lga','nysc_year','olevel_exam_date',
    152             'olevel_exam_date2','olevel_exam_number','olevel_exam_number2',
    153             'olevel_results','olevel_results2','olevel_school','olevel_school2',
    154             'olevel_type','olevel_type2','password','phone','presently_inst',
    155             'reg_number','religion','result_uploaded','scd_sit_date',
    156             'scd_sit_fname','scd_sit_no','scd_sit_results','scd_sit_type',
    157             'screening_date','screening_score','screening_venue','sex',
    158             'ignore_special','special_application','state','student_id',
    159             'suspended','ignore_translated_state'],
    160             mode='update')
    161         num_succ, num_fail, finished_path, failed_path = result
    162         self.assertEqual(num_succ,1)
    163         self.assertEqual(num_fail,0)
    164         return
    165 
    166 
    16772class ApplicantsContainerUITests(ApplicantsFullSetup):
    16873    # Tests for ApplicantsContainer class views and pages
Note: See TracChangeset for help on using the changeset viewer.