Ignore:
Timestamp:
4 Nov 2013, 10:57:34 (11 years ago)
Author:
Henrik Bettermann
Message:

Customize course registration slip.

File:
1 edited

Legend:

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

    r10691 r10692  
    3232from waeup.kofa.interfaces import (
    3333    IExtFileStore, IFileStoreNameChooser)
     34from waeup.kofa.browser.tests.test_pdf import samples_dir
    3435from waeup.kofa.students.interfaces import IStudentsUtils
    3536from waeup.kwarapoly.testing import FunctionalLayer
     
    348349
    349350    def test_pdf_slips(self):
    350         IWorkflowState(self.student).setState('school fee paid')
    351351        # Login
    352352        self.browser.open(self.login_path)
     
    354354        self.browser.getControl(name="form.password").value = 'spwd'
    355355        self.browser.getControl("Login").click()
     356        # admission slip
     357        IWorkflowState(self.student).setState('school fee paid')
    356358        self.browser.open(self.student_path)
    357359        self.browser.getLink("Download admission letter").click()
     
    359361        self.assertEqual(self.browser.headers['Content-Type'],
    360362                         'application/pdf')
     363        path = os.path.join(samples_dir(), 'admission_slip.pdf')
     364        open(path, 'wb').write(self.browser.contents)
     365        print "Sample PDF admission_slip_slip.pdf written to %s" % path
    361366        self.browser.open(self.student_path)
    362367        self.assertRaises(
     
    364369        self.browser.open(self.student_path, 'admission_notification.pdf')
    365370        self.assertFalse('Not allowed' in self.browser.contents)
    366 
     371        # admission notification
    367372        IWorkflowState(self.student).setState('cleared')
    368373        self.browser.open(self.student_path)
     
    371376        self.assertEqual(self.browser.headers['Content-Type'],
    372377                         'application/pdf')
     378        path = os.path.join(samples_dir(), 'admission_notification.pdf')
     379        open(path, 'wb').write(self.browser.contents)
     380        print "Sample PDF admission_notification.pdf written to %s" % path
    373381        self.browser.open(self.student_path)
    374382        self.assertRaises(
     
    377385        self.assertFalse('Not allowed' in self.browser.contents)
    378386        return
     387
     388    def test_course_registration_pdf_slip(self):
     389        # Student cant login if their password is not set
     390        IWorkflowState(self.student).setState('school fee paid')
     391        self.browser.open(self.login_path)
     392        self.browser.getControl(name="form.login").value = self.student_id
     393        self.browser.getControl(name="form.password").value = 'spwd'
     394        self.browser.getControl("Login").click()
     395        self.browser.getLink("Study Course").click()
     396        self.browser.getLink("Add course list").click()
     397        self.assertMatches('...Add current level 100 (Year 1)...',
     398                           self.browser.contents)
     399        self.browser.getControl("Create course list now").click()
     400        # A level with one course ticket was created
     401        self.browser.getLink("100").click()
     402        self.browser.getLink("Download course registration slip").click()
     403        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     404        self.assertEqual(self.browser.headers['Content-Type'],
     405                         'application/pdf')
     406        path = os.path.join(samples_dir(), 'course_registration_slip.pdf')
     407        open(path, 'wb').write(self.browser.contents)
     408        print "Sample PDF course_registration_slip.pdf written to %s" % path
     409        return
Note: See TracChangeset for help on using the changeset viewer.