Ignore:
Timestamp:
10 Jan 2016, 22:18:06 (9 years ago)
Author:
Henrik Bettermann
Message:

Implement first draft of bursary clearance slip.

File:
1 edited

Legend:

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

    r13460 r13583  
    2020import tempfile
    2121import pytz
     22from time import time
    2223from datetime import datetime, timedelta, date
    2324from StringIO import StringIO
     
    10431044        self.assertEqual(self.student['payments'][value].amount_auth, 987.0)
    10441045        return
     1046
     1047    def test_bursary_pdf_slip(self):
     1048        payment1 = createObject(u'waeup.StudentOnlinePayment')
     1049        timestamp = ("%d" % int(time()*10000))[1:]
     1050        payment1.p_id = "p%s" % timestamp
     1051        payment1.p_category = 'schoolfee'
     1052        payment1.p_item = u'My School Fee'
     1053        payment1.p_session = 2015
     1054        payment1.p_level = 100
     1055        payment1.p_current = True
     1056        payment1.amount_auth = 23456.9
     1057        payment1.approve()
     1058        payment2 = createObject(u'waeup.StudentOnlinePayment')
     1059        timestamp = ("%d" % int(time()*10000))[1:]
     1060        payment2.p_id = "p%s" % timestamp
     1061        payment2.p_category = 'clearance'
     1062        payment2.p_item = u'My Clearance Fee'
     1063        payment2.p_session = 2015
     1064        payment2.p_level = 100
     1065        payment2.p_current = True
     1066        payment2.amount_auth = 5678.6
     1067        payment2.approve()
     1068        self.student['payments'][payment1.p_id] = payment1
     1069        self.student['payments'][payment2.p_id] = payment2
     1070        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     1071        self.browser.open(self.student_path + '/bursary_clearance_slip.pdf')
     1072        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     1073        self.assertEqual(self.browser.headers['Content-Type'],
     1074                         'application/pdf')
     1075        path = os.path.join(samples_dir(), 'bursary_clearance_slip.pdf')
     1076        open(path, 'wb').write(self.browser.contents)
     1077        print "Sample PDF bursary_clearance_slip.pdf written to %s" % path
     1078        return
Note: See TracChangeset for help on using the changeset viewer.