Ignore:
Timestamp:
23 Apr 2013, 09:39:09 (12 years ago)
Author:
Henrik Bettermann
Message:

Simplify logging. files_uploaded attribute is redundant.

File:
1 edited

Legend:

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

    r10030 r10095  
    708708        self.assertTrue(passport1 == passport2)
    709709        return
     710
     711    def test_upload_image_by_manager_with_logging(self):
     712        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     713        self.browser.open(self.manage_path)
     714        # Create a pseudo image file and select it to be uploaded in form
     715        photo_content = 'A' * 1024 * 5  # A string of 5 KB size
     716        pseudo_image = StringIO(photo_content)
     717        ctrl = self.browser.getControl(name='form.passport')
     718        file_ctrl = ctrl.mech_control
     719        file_ctrl.add_file(pseudo_image, filename='myphoto.jpg')
     720        self.browser.getControl("Save").click() # submit form
     721        # Even though the form could not be saved ...
     722        self.assertTrue(
     723            'Required input is missing' in self.browser.contents)
     724        # ... the file has been successfully uploaded
     725        logfile = os.path.join(
     726            self.app['datacenter'].storage, 'logs', 'applicants.log')
     727        logcontent = open(logfile).read()
     728        self.assertTrue(
     729            'zope.mgr - applicants.browser.ApplicantManageFormPage - '
     730            '%s - saved: passport'
     731            % (self.applicant.applicant_id)
     732            in logcontent)
    710733
    711734    def test_pay_application_fee(self):
Note: See TracChangeset for help on using the changeset viewer.