Changeset 7027
- Timestamp:
- 8 Nov 2011, 06:42:07 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r7026 r7027 1265 1265 return 'Bed Ticket %s' % self.context.getSessionString() 1266 1266 1267 class BedTicketSlipActionButton(ManageActionButton): 1268 grok.context(IBedTicket) 1269 grok.require('waeup.viewStudent') 1270 icon = 'actionicon_pdf.png' 1271 text = 'Download bed allocation slip' 1272 target = 'bed_allocation.pdf' 1273 1274 class ExportPDFBedTicketSlipPage(grok.View): 1275 """Deliver a PDF slip of the context. 1276 """ 1277 grok.context(IBedTicket) 1278 grok.name('bed_allocation.pdf') 1279 grok.require('waeup.viewStudent') 1280 form_fields = grok.AutoFields(IBedTicket) 1281 form_fields['booking_date'].custom_widget = FriendlyDateDisplayWidget('le') 1282 prefix = 'form' 1283 1284 @property 1285 def label(self): 1286 return 'Bed Allocation %s' % self.context.bed_coordinates 1287 1288 def render(self): 1289 studentview = StudentBaseDisplayFormPage(self.context.getStudent(), 1290 self.request) 1291 return renderPDF(self,'Bed Allocation', 'bed_allocation.pdf', 1292 self.context.getStudent, studentview) 1293 1267 1294 class RelocateStudentActionButton(ManageActionButton): 1268 grok.order( 1)1295 grok.order(2) 1269 1296 grok.context(IBedTicket) 1270 1297 grok.view(BedTicketDisplayFormPage) -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r7026 r7027 981 981 parts = pin.split('-')[1:] 982 982 sfeseries, sfenumber = parts 983 983 984 # Students can use HOS code and book a bed space with it 984 985 self.browser.open(self.acco_student_path) … … 995 996 self.assertMatches('...Hall 1, Block A, Room 101, Bed A...', 996 997 self.browser.contents) 998 997 999 # Bed has been allocated 998 1000 bed = self.app['hostels']['hall-1']['hall-1_A_101_A'] 999 1001 self.assertTrue(bed.owner == self.student_id) 1002 1000 1003 # BedTicketAddPage is now blocked 1001 1004 self.browser.getLink("Book accommodation").click() 1002 1005 self.assertMatches('...You already booked a bed space...', 1003 1006 self.browser.contents) 1007 1004 1008 # The bed ticket displays the data correctly 1005 1009 self.browser.open(self.acco_student_path + '/2004') … … 1009 1013 self.assertMatches('...regular_male_fr...', self.browser.contents) 1010 1014 self.assertMatches('...%s...' % pin, self.browser.contents) 1015 1016 # Students can open the pdf slip 1017 self.browser.open(self.browser.url + '/bed_allocation.pdf') 1018 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1019 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 1020 1011 1021 # Students can't relocate themselves 1012 1022 self.assertFalse('Relocate' in self.browser.contents) … … 1014 1024 self.assertRaises( 1015 1025 Unauthorized, self.browser.open, relocate_path) 1026 1016 1027 # Students can't the Remove button and check boxes 1017 1028 self.browser.open(self.acco_student_path)
Note: See TracChangeset for help on using the changeset viewer.