Changeset 17845 for main/waeup.uniben/trunk/src/waeup/uniben
- Timestamp:
- 13 Jul 2024, 08:43:56 (5 months ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py
r17835 r17845 19 19 import os 20 20 import csv 21 import pytz 21 22 from datetime import datetime 22 23 from zope.i18n import translate … … 24 25 from zope.schema.interfaces import ConstraintNotSatisfied 25 26 from zope.formlib.textwidgets import BytesDisplayWidget 26 from zope.component import getUtility 27 from zope.component import getUtility, queryUtility 27 28 from hurry.workflow.interfaces import IWorkflowInfo 28 29 from waeup.kofa.interfaces import ( … … 64 65 NigeriaAccommodationDisplayFormPage, 65 66 NigeriaStudentBaseDisplayFormPage, 67 NigeriaExportPDFFinancialClearancePage, 66 68 ) 67 69 from waeup.uniben.students.interfaces import ( … … 1127 1129 msave(self, **data) 1128 1130 return 1131 1132 class CustomNigeriaExportPDFFinancialClearancePage(NigeriaExportPDFFinancialClearancePage): 1133 """Deliver a PDF financial clearance slip. 1134 """ 1135 1136 @property 1137 def note(self): 1138 if self.context.nysc and self.context.nysc_updated: 1139 nysc_updated = self.context.nysc_updated.strftime('%d/%m/%Y') 1140 return """ 1141 NYSC requested on %s. 1142 1143 Senate Info: %s 1144 """ % (nysc_updated, self.context.nysc_senate_info) 1145 else: 1146 return -
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r17542 r17845 20 20 import tempfile 21 21 import pytz 22 from time import time 22 23 from datetime import datetime, timedelta, date 23 24 from StringIO import StringIO … … 1260 1261 open(path, 'wb').write(self.browser.contents) 1261 1262 print "Sample PDF tiship_slip.pdf written to %s" % path 1263 1264 def test_fiancial_clearance_pdf_slip(self): 1265 payment1 = createObject(u'waeup.StudentOnlinePayment') 1266 timestamp = ("%d" % int(time()*10000))[1:] 1267 payment1.p_id = "LSCNEW-2-4153206270" # the longest possible p_id 1268 payment1.p_category = 'schoolfee' 1269 payment1.p_item = u'My School Fee' 1270 payment1.p_session = 2015 1271 payment1.p_level = 100 1272 payment1.p_current = True 1273 payment1.amount_auth = 23456.9 1274 payment1.approve() 1275 payment2 = createObject(u'waeup.StudentOnlinePayment') 1276 timestamp = ("%d" % int(time()*10000))[1:] 1277 payment2.p_id = "p%s" % timestamp 1278 payment2.p_category = 'clearance' 1279 payment2.p_item = u'My Clearance Fee' 1280 payment2.p_session = 2015 1281 payment2.p_level = 100 1282 payment2.p_current = True 1283 payment2.amount_auth = 5678.6 1284 payment2.approve() 1285 self.student['payments'][payment1.p_id] = payment1 1286 self.student['payments'][payment2.p_id] = payment2 1287 self.student.nysc = True 1288 self.student.nysc_updated = datetime.now(pytz.utc) 1289 self.student.nysc_senate_info = u'Senate Info test' 1290 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 1291 self.browser.open(self.student_path + '/clear_financially') 1292 self.browser.getLink("Download fee payment history").click() 1293 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1294 self.assertEqual(self.browser.headers['Content-Type'], 1295 'application/pdf') 1296 path = os.path.join(samples_dir(), 'fee_payment_history.pdf') 1297 open(path, 'wb').write(self.browser.contents) 1298 print "Sample PDF fee_payment_history.pdf written to %s" % path 1299 return
Note: See TracChangeset for help on using the changeset viewer.