Ignore:
Timestamp:
12 Apr 2012, 06:27:43 (13 years ago)
Author:
Henrik Bettermann
Message:

Test clearance slip with a true jpeg image.

The test fails because I forgot to add a View button.

File:
1 edited

Legend:

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

    r8116 r8118  
    534534            '<a target="image" href="birth_certificate">'
    535535            in self.browser.contents)
    536         # Managers can open the pdf slip
    537         self.browser.open(self.clearance_path)
    538         self.browser.getLink("slip").click()
    539         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    540         self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
    541536        # Browsing the link shows a real image
    542537        self.browser.open('birth_certificate')
     
    623618            '<img align="middle" height="125px" src="passport.jpg" />'
    624619            in self.browser.contents)
    625         # The clearance slip can't be opened because it requires a proper
    626         # passport jpg file.
    627         self.browser.open(self.student_path + '/clearance.pdf')
    628         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    629         self.assertTrue('Error in image file' in self.browser.contents)
    630620        # We remove the passport file again
    631621        self.browser.open(self.manage_student_path)
     
    11751165        # and go back to the edit form
    11761166        self.browser.getLink("Edit").click()
     1167        # Students can upload documents
     1168        ctrl = self.browser.getControl(name='birthcertificateupload')
     1169        file_obj = open(
     1170            os.path.join(os.path.dirname(__file__), 'test_image.jpg'),'rb')
     1171        file_ctrl = ctrl.mech_control
     1172        file_ctrl.add_file(file_obj, filename='my_birth_certificate.jpg')
     1173        self.browser.getControl(
     1174            name='upload_birthcertificateupload').click()
     1175        self.assertTrue(
     1176            '<a target="image" href="birth_certificate">Birth Certificate Scan</a>'
     1177            in self.browser.contents)
     1178        # Students can open clearance slip
     1179        self.browser.getLink("View").click()
     1180        self.browser.getLink("Download clearance slip").click()
     1181        print self.browser.contents
     1182        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     1183        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     1184        # Students can request clearance
    11771185        self.browser.getControl("Save and request clearance").click()
    1178        
    11791186        self.browser.getControl(name="ac_series").value = self.existing_clrseries
    11801187        self.browser.getControl(name="ac_number").value = self.existing_clrnumber
Note: See TracChangeset for help on using the changeset viewer.