Ignore:
Timestamp:
16 Nov 2011, 21:31:38 (13 years ago)
Author:
Henrik Bettermann
Message:

Let applicants cooperate with new imagestorage. Fix tests.

Extend permissions for PortalManager?.

File:
1 edited

Legend:

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

    r7111 r7122  
    372372        self.browser.open(self.edit_clearance_student_path)
    373373        pseudo_image = StringIO('I pretend to be a graphics file')
    374         ctrl = self.browser.getControl(name='birth_certificate')
     374        ctrl = self.browser.getControl(name='birthcertificateuploadmanage')
    375375        file_ctrl = ctrl.mech_control
    376376        file_ctrl.add_file(pseudo_image, filename='my_birth_certificate.jpg')
     
    382382        # ... but the correct upload submit button does
    383383        pseudo_image = StringIO('I pretend to be a graphics file')
    384         ctrl = self.browser.getControl(name='birth_certificate')
     384        ctrl = self.browser.getControl(name='birthcertificateuploadmanage')
    385385        file_ctrl = ctrl.mech_control
    386386        file_ctrl.add_file(pseudo_image, filename='my_birth_certificate.jpg')
    387         self.browser.getControl(name='upload_birth_certificate').click()
     387        self.browser.getControl(
     388            name='upload_birthcertificateuploadmanage').click()
    388389        # There is a correct <img> link included
    389390        self.assertTrue(
    390391            '<a target="image" href="birth_certificate.jpg">'
    391392            in self.browser.contents)
     393
    392394        # Browsing the link shows a real image
    393395        self.browser.open('birth_certificate.jpg')
     
    399401        photo_content = 'A' * 1024 * 151  # A string of 21 KB size
    400402        pseudo_image = StringIO(photo_content)
    401         ctrl = self.browser.getControl(name='birth_certificate')
     403        ctrl = self.browser.getControl(name='birthcertificateuploadmanage')
    402404        file_ctrl = ctrl.mech_control
    403405        file_ctrl.add_file(pseudo_image, filename='my_birth_certificate.jpg')
    404         self.browser.getControl(name='upload_birth_certificate').click()
     406        self.browser.getControl(
     407            name='upload_birthcertificateuploadmanage').click()
    405408        self.assertTrue(
    406409            'Uploaded file is too big' in self.browser.contents)
    407410        # File names must meet several conditions
    408411        pseudo_image = StringIO('I pretend to be a graphics file')
    409         ctrl = self.browser.getControl(name='birth_certificate')
     412        ctrl = self.browser.getControl(name='birthcertificateuploadmanage')
    410413        file_ctrl = ctrl.mech_control
    411414        file_ctrl.add_file(pseudo_image, filename='my.photo.jpg')
    412         self.browser.getControl(name='upload_birth_certificate').click()
     415        self.browser.getControl(
     416            name='upload_birthcertificateuploadmanage').click()
    413417        self.assertTrue('File name contains more than one dot'
    414418            in self.browser.contents)
    415         ctrl = self.browser.getControl(name='birth_certificate')
     419        ctrl = self.browser.getControl(name='birthcertificateuploadmanage')
    416420        file_ctrl = ctrl.mech_control
    417421        file_ctrl.add_file(pseudo_image, filename='my_birth_certificate')
    418         self.browser.getControl(name='upload_birth_certificate').click()
     422        self.browser.getControl(
     423            name='upload_birthcertificateuploadmanage').click()
    419424        self.assertTrue('File name has no extension' in self.browser.contents)
    420         ctrl = self.browser.getControl(name='birth_certificate')
     425        ctrl = self.browser.getControl(name='birthcertificateuploadmanage')
    421426        file_ctrl = ctrl.mech_control
    422427        file_ctrl.add_file(pseudo_image, filename='my_birth_certificate.bmp')
    423         self.browser.getControl(name='upload_birth_certificate').click()
     428        self.browser.getControl(
     429            name='upload_birthcertificateuploadmanage').click()
    424430        self.assertTrue('.jpg file extension expected' in self.browser.contents)
    425431        # Managers can delete files
    426         self.browser.getControl(name='delete_birth_certificate').click()
     432        self.browser.getControl(name='delete_birthcertificateuploadmanage').click()
    427433        self.assertTrue(
    428434            'File birth_certificate.jpg deleted'
     
    431437        self.browser.open(self.edit_clearance_student_path)
    432438        pseudo_image = StringIO('I pretend to be a graphics file')
    433         ctrl = self.browser.getControl(name='birth_certificate')
     439        ctrl = self.browser.getControl(name='birthcertificateuploadmanage')
    434440        file_ctrl = ctrl.mech_control
    435441        file_ctrl.add_file(pseudo_image, filename='my_acceptance_letter.jpg')
    436         self.browser.getControl(name='upload_acceptance_letter').click()
     442        self.browser.getControl(
     443            name='upload_acceptanceletteruploadmanage').click()
    437444        self.assertFalse(
    438445            '<a target="image" href="acceptance_letter.jpg">'
    439446            in self.browser.contents)
    440         ctrl = self.browser.getControl(name='acceptance_letter')
     447        ctrl = self.browser.getControl(name='acceptanceletteruploadmanage')
    441448        file_ctrl = ctrl.mech_control
    442449        file_ctrl.add_file(pseudo_image, filename='my_acceptance_letter.jpg')
    443         self.browser.getControl(name='upload_acceptance_letter').click()
     450        self.browser.getControl(
     451            name='upload_acceptanceletteruploadmanage').click()
    444452        self.assertTrue(
    445453            '<a target="image" href="acceptance_letter.jpg">'
    446454            in self.browser.contents)
    447         self.browser.getControl(name='delete_acceptance_letter').click()
     455        self.browser.getControl(
     456            name='delete_acceptanceletteruploadmanage').click()
    448457        self.assertTrue(
    449458            'File acceptance_letter.jpg deleted'
Note: See TracChangeset for help on using the changeset viewer.