- Timestamp:
- 4 Nov 2013, 10:57:34 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/tests/test_browser.py
r10691 r10692 32 32 from waeup.kofa.interfaces import ( 33 33 IExtFileStore, IFileStoreNameChooser) 34 from waeup.kofa.browser.tests.test_pdf import samples_dir 34 35 from waeup.kofa.students.interfaces import IStudentsUtils 35 36 from waeup.kwarapoly.testing import FunctionalLayer … … 348 349 349 350 def test_pdf_slips(self): 350 IWorkflowState(self.student).setState('school fee paid')351 351 # Login 352 352 self.browser.open(self.login_path) … … 354 354 self.browser.getControl(name="form.password").value = 'spwd' 355 355 self.browser.getControl("Login").click() 356 # admission slip 357 IWorkflowState(self.student).setState('school fee paid') 356 358 self.browser.open(self.student_path) 357 359 self.browser.getLink("Download admission letter").click() … … 359 361 self.assertEqual(self.browser.headers['Content-Type'], 360 362 '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 361 366 self.browser.open(self.student_path) 362 367 self.assertRaises( … … 364 369 self.browser.open(self.student_path, 'admission_notification.pdf') 365 370 self.assertFalse('Not allowed' in self.browser.contents) 366 371 # admission notification 367 372 IWorkflowState(self.student).setState('cleared') 368 373 self.browser.open(self.student_path) … … 371 376 self.assertEqual(self.browser.headers['Content-Type'], 372 377 '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 373 381 self.browser.open(self.student_path) 374 382 self.assertRaises( … … 377 385 self.assertFalse('Not allowed' in self.browser.contents) 378 386 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.