Ignore:
Timestamp:
23 Feb 2016, 17:36:46 (9 years ago)
Author:
Henrik Bettermann
Message:

Add exam schedule examination slip.

Fix test.

File:
1 edited

Legend:

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

    r13621 r13723  
    194194        self.browser.open(self.student_path + '/edit_personal')
    195195        self.assertTrue('parent_email' in self.browser.contents)
     196
     197    def test_examination_schedule_slip(self):
     198        self.student.flash_notice = u'My Examination Date'
     199        self.browser.open(self.login_path)
     200        self.browser.getControl(name="form.login").value = self.student_id
     201        self.browser.getControl(name="form.password").value = 'spwd'
     202        self.browser.getControl("Login").click()
     203        self.browser.getLink("Download examination schedule slip").click()
     204        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     205        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     206        path = os.path.join(samples_dir(), 'examination_schedule_slip.pdf')
     207        open(path, 'wb').write(self.browser.contents)
     208        print "Sample PDF examination_schedule_slip.pdf written to %s" % path
     209        # If flash_notive does not contain exam' the button does not show up.
     210        self.student.flash_notice = u'anything'
     211        self.browser.open(self.student_path)
     212        self.assertFalse('examination schedule slip' in self.browser.contents)
    196213
    197214    def test_manage_payments(self):
     
    929946        self.browser.getControl(name="form.p_category").value = ['bed_allocation']
    930947        self.browser.getControl("Create ticket").click()
    931         ctrl = self.browser.getControl(name='val_id')
    932         value = ctrl.options[0]
    933         self.browser.getLink(value).click()
    934948        p_ticket = self.student['payments'].values()[0]
    935949        p_ticket.approveStudentPayment()
     
    10291043        self.assertMatches('...Payment ticket created...',
    10301044                           self.browser.contents)
    1031         ctrl = self.browser.getControl(name='val_id')
    1032         value = ctrl.options[0]
    10331045        # Maintennace fee is taken from the hostel object.
    1034         self.assertEqual(self.student['payments'][value].amount_auth, 876.0)
     1046        self.assertEqual(self.student['payments'].values()[1].amount_auth, 876.0)
    10351047        # If the hostel's maintenance fee isn't set, the fee is
    10361048        # taken from the session configuration object.
     
    10391051        self.browser.getControl(name="form.p_category").value = ['hostel_maintenance']
    10401052        self.browser.getControl("Create ticket").click()
    1041         ctrl = self.browser.getControl(name='val_id')
    1042         value = ctrl.options[1]
    1043         self.assertEqual(self.student['payments'][value].amount_auth, 987.0)
     1053        self.assertEqual(self.student['payments'].values()[2].amount_auth, 987.0)
    10441054        return
Note: See TracChangeset for help on using the changeset viewer.