Ignore:
Timestamp:
3 May 2012, 20:43:02 (13 years ago)
Author:
Henrik Bettermann
Message:

Update password and state correctly.

Fix and improve logging. Do not log initial transition. They are always performed twice (due to applicant creation in converter).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_batching.py

    r8332 r8334  
    245245        open(self.csv_file_update2, 'wb').write(APPLICANT_SAMPLE_DATA_UPDATE2)
    246246
     247        self.logfile = os.path.join(
     248            self.app['datacenter'].storage, 'logs', 'applicants.log')
     249
    247250    def test_interface(self):
    248251        # Make sure we fulfill the interface contracts.
     
    289292        assert applicant.__implemented__.__name__ == (
    290293            'waeup.kofa.applicants.applicant.Applicant')
     294        logcontent = open(self.logfile).read()
     295        # Logging message from updateEntry,
     296        # create applicant with given application_number
     297        self.assertTrue(
     298            'Applicant imported: applicant_id=dp2011_1234, password=mypwd1, '
     299            'reg_number=1001, firstname=Aaren, middlename=Peter, lastname=Pieri, '
     300            'sex=m, course1=CERT1, date_of_birth=1990-01-02, email=xx@yy.zz' in
     301            logcontent)
     302        # create applicant with random application_number which is
     303        # not shown in the log file
     304        self.assertTrue(
     305            'Applicant imported: reg_number=1003, firstname=Aaren, '
     306            'middlename=Alfons, lastname=Berson, sex=m, course1=CERT1, '
     307            'date_of_birth=1990-01-04, email=xx@yy.zz' in
     308            logcontent)
    291309        shutil.rmtree(os.path.dirname(fin_file))
    292310
     
    327345        self.assertTrue(IUserAccount(container['1234']).checkPassword('mypwd1'))
    328346        # password of Finau is still unset
    329         self.assertEqual(IUserAccount(container['2345']).password,'')
     347        self.assertEqual(IUserAccount(container['2345']).password,None)
    330348        # reg_number of Finau has changed
    331349        self.assertEqual(container['2345'].reg_number, '6666')
     350        logcontent = open(self.logfile).read()
     351
     352        # Logging message from updateEntry,
     353        # reg_number is locator
     354        self.assertTrue(
     355            'Applicant updated: reg_number=1001, firstname=Aaren' in
     356            logcontent)
     357        # applicant_id is locator
     358        self.assertTrue(
     359            'Applicant updated: state=admitted, reg_number=6666, '
     360            'firstname=Alfons, applicant_id=dp2011_2345' in
     361            logcontent)
     362
    332363        shutil.rmtree(os.path.dirname(fin_file))
    333364
     
    350381            self.csv_file_update, APPLICANT_HEADER_FIELDS_UPDATE, 'remove')
    351382        self.assertEqual(num_warns,0)
    352         shutil.rmtree(os.path.dirname(fin_file))
     383        logcontent = open(self.logfile).read()
     384
     385        # Logging message from handle_applicant_transition_event
     386        self.assertTrue(
     387            'dp2011_1234 - Applicant record removed' in
     388            logcontent)
     389
     390        shutil.rmtree(os.path.dirname(fin_file))
Note: See TracChangeset for help on using the changeset viewer.