Ignore:
Timestamp:
13 Apr 2021, 10:32:16 (4 years ago)
Author:
Henrik Bettermann
Message:

Students must upload new passport picture before requesting clearance.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py

    r16452 r16456  
    146146    def dataNotComplete(self):
    147147        store = getUtility(IExtFileStore)
     148        if not store.getFileByContext(self.context, attr=u'passport.jpg'):
     149            return _('No red background passport picture uploaded.')
    148150        if not store.getFileByContext(self.context, attr=u'birth_certificate.jpg'):
    149151            return _('No birth certificate uploaded.')
     
    780782            emit_lock_message(self)
    781783            return
    782         # Passport pictures must not be editable if application slip
    783         # exists.
    784784        slip = getUtility(IExtFileStore).getFileByContext(
    785785            self.context, 'application_slip')
    786786        PORTRAIT_CHANGE_STATES = getUtility(IStudentsUtils).PORTRAIT_CHANGE_STATES
    787         if self.context.state not in PORTRAIT_CHANGE_STATES or slip is not None:
     787        if self.context.state not in PORTRAIT_CHANGE_STATES:
    788788            emit_lock_message(self)
    789789            return
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r16447 r16456  
    4545
    4646SAMPLE_FPM = os.path.join(os.path.dirname(__file__), 'sample.fpm')
    47 SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg')
     47SAMPLE_PASSPORT = os.path.join(os.path.dirname(__file__), 'test_image.jpg')
    4848
    4949class OfficerUITests(StudentsFullSetup):
     
    157157        # have been uploaded.
    158158        self.browser.getControl("Save and request clearance").click()
     159
     160        self.assertTrue('No red background passport picture uploaded'
     161            in self.browser.contents)
     162        passport = 'My passport picture'
     163        file_id = IFileStoreNameChooser(self.student).chooseName(
     164            attr="passport.jpg")
     165        image = open(SAMPLE_PASSPORT, 'rb')
     166        file_store.createFile(file_id, image)
     167        self.browser.open(self.edit_clearance_path)
     168        self.browser.getControl("Save and request clearance").click()
     169
    159170        self.assertTrue('No birth certificate uploaded'
    160171            in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.