Ignore:
Timestamp:
25 Jun 2020, 05:18:16 (4 years ago)
Author:
Henrik Bettermann
Message:

Customize admission slip.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/tests/test_browser.py

    r16087 r16127  
    138138        open(path, 'wb').write(self.browser.contents)
    139139        print "Sample PDF basedata_slip.pdf written to %s" % path
     140
     141    def test_student_admission_letter(self):
     142        # Student cant login if their password is not set
     143        IWorkflowInfo(self.student).fireTransition('admit')
     144        self.browser.open(self.login_path)
     145        self.browser.getControl(name="form.login").value = self.student_id
     146        self.browser.getControl(name="form.password").value = 'spwd'
     147        self.browser.getControl("Login").click()
     148        self.assertMatches(
     149            '...You logged in...', self.browser.contents)
     150        # Admitted student can upload a passport picture
     151        #self.browser.open(self.student_path + '/change_portrait')
     152        #ctrl = self.browser.getControl(name='passportuploadedit')
     153        #file_obj = open(SAMPLE_IMAGE, 'rb')
     154        #file_ctrl = ctrl.mech_control
     155        #file_ctrl.add_file(file_obj, filename='my_photo.jpg')
     156        #self.browser.getControl(
     157        #    name='upload_passportuploadedit').click()
     158        #self.assertTrue(
     159        #    'src="http://localhost/app/students/K1000000/passport.jpg"'
     160        #    in self.browser.contents)
     161        # Students can open admission letter
     162        self.browser.getLink("Base Data").click()
     163        self.browser.getLink("Download admission letter").click()
     164        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     165        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     166        path = os.path.join(samples_dir(), 'admission_slip.pdf')
     167        open(path, 'wb').write(self.browser.contents)
     168        print "Sample PDF admission_slip.pdf written to %s" % path
Note: See TracChangeset for help on using the changeset viewer.