Ignore:
Timestamp:
14 Nov 2011, 10:01:17 (13 years ago)
Author:
Henrik Bettermann
Message:

Reorganize file upload. Each viewlet gets an upload and a delete button and writes its own log message. Thus there is one line per file deletion or file upload in the log file. The save action does no longer upload the files.

It works perfectly in the UI but I have still some problems with the browser test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r7106 r7108  
    365365        # as birth certificate
    366366        pseudo_image = StringIO('I pretend to be a graphics file')
    367         ctrl = self.browser.getControl(name='form.birth_certificate')
     367        ctrl = self.browser.getControl(name='birth_certificate')
    368368        file_ctrl = ctrl.mech_control
    369369        file_ctrl.add_file(pseudo_image, filename='myphoto.jpg')
    370         self.browser.getControl("Save").click() # submit form
    371         # Form has errors ...
    372         self.assertTrue(
    373             'Required input is missing' in self.browser.contents)
    374         # ... but file has been uploaded and a correct <img> link included
    375         self.assertTrue(
     370        # The Save action does not upload files
     371        self.browser.getControl("Save (no upload)").click() # submit form
     372        self.assertFalse(
    376373            '<a target="image" href="birth_certificate.jpg">' in self.browser.contents)
     374        # ... but the Upload submit button
     375        import pdb; pdb.set_trace()
     376        ctrl = self.browser.getControl(name='birth_certificate')
     377        file_ctrl = ctrl.mech_control
     378        file_ctrl.add_file(pseudo_image, filename='myphoto.jpg')
     379        self.browser.getControl("Upload").click() # submit form
    377380        # There is a correct <img> link included
    378381        self.assertTrue(
     
    388391        photo_content = 'A' * 1024 * 151  # A string of 21 KB size
    389392        pseudo_image = StringIO(photo_content)
    390         ctrl = self.browser.getControl(name='form.birth_certificate')
     393        ctrl = self.browser.getControl(name='birth_certificate')
    391394        file_ctrl = ctrl.mech_control
    392395        file_ctrl.add_file(pseudo_image, filename='myphoto.jpg')
Note: See TracChangeset for help on using the changeset viewer.