Ignore:
Timestamp:
3 May 2012, 07:28:57 (13 years ago)
Author:
Henrik Bettermann
Message:

Let's do the applicant importer do what it's supposed to do.

Some catalog searches are performed twice during import of a row. This can only be improved by modifying doImport in the base class.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/sample_applicant_data_update.csv

    r8290 r8331  
    1 container_code,reg_number,firstname,middlename,state
    2 dp2011,1001,Aaren,,
    3 dp2011,1002,Alfons,,admitted
    4 dp2011,1003,Abraham,,
     1applicant_id,reg_number,firstname,middlename,state
     2,1001,Aaren,,
     3dp2011_2345,6666,Alfons,,admitted
     4,1003,Abraham,,
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/sample_applicant_data_update2.csv

    r8290 r8331  
    1 container_code,reg_number,firstname,middlename,application_number
    2 dp2011,1001,Aaren,XXX,
    3 dp2011,1002,Alfons,XXX,
    4 dp2011,1003,Abraham,XXX,
     1applicant_id,reg_number,firstname,middlename
     2dp2011_1234,,Aaren,XXX
     3,6666,Alfons,XXX
     4,1003,Abraham,XXX
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_batching.py

    r8311 r8331  
    2424import tempfile
    2525import unittest
     26import grok
    2627from zope.component.hooks import setSite, clearSite
    2728from zope.component import createObject
    2829from zope.interface.verify import verifyClass, verifyObject
     30from zope.event import notify
    2931
    3032from waeup.kofa.app import University
     
    6870
    6971APPLICANT_HEADER_FIELDS_UPDATE = APPLICANT_SAMPLE_DATA_UPDATE.split(
     72    '\n')[0].split(',')
     73
     74APPLICANT_HEADER_FIELDS_UPDATE2 = APPLICANT_SAMPLE_DATA_UPDATE2.split(
    7075    '\n')[0].split(',')
    7176
     
    310315        num, num_warns, fin_file, fail_file = self.processor.doImport(
    311316            self.csv_file_update, APPLICANT_HEADER_FIELDS_UPDATE, 'update')
    312         #content = open(fail_file).read()
    313317        self.assertEqual(num_warns,0)
    314318        # The middlename import value was None.
     
    324328        # password of Finau is still unset
    325329        self.assertEqual(IUserAccount(container['2345']).password,'')
    326         shutil.rmtree(os.path.dirname(fin_file))
    327         # Now we import another file which clears all middlename attributes.
    328         num, num_warns, fin_file, fail_file = self.processor.doImport(
    329             self.csv_file_update2, APPLICANT_HEADER_FIELDS_UPDATE, 'update')
     330        # reg_number of Finau has changed
     331        self.assertEqual(container['2345'].reg_number, '6666')
     332        shutil.rmtree(os.path.dirname(fin_file))
     333        # We have to inform the catalog that the reg_number has changed
     334        notify(grok.ObjectModifiedEvent(container['2345']))
     335        # Now we import another file which clears all middlename attributes
     336        # and uses the new reg_number as locator
     337        num, num_warns, fin_file, fail_file = self.processor.doImport(
     338            self.csv_file_update2, APPLICANT_HEADER_FIELDS_UPDATE2, 'update')
     339        #content = open(fail_file).read()
     340        #print content
    330341        self.assertEqual(num_warns,0)
    331342        assert container['1234'].middlename is None
Note: See TracChangeset for help on using the changeset viewer.