Changeset 15185 for main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/tests/test_browser.py
- Timestamp:
- 12 Oct 2018, 15:51:59 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/tests/test_browser.py
r15000 r15185 21 21 from StringIO import StringIO 22 22 from hurry.workflow.interfaces import IWorkflowState, IWorkflowInfo 23 from mechanize import LinkNotFoundError 23 24 from zope.securitypolicy.interfaces import IPrincipalRoleManager 24 25 from zope.component.hooks import setSite, clearSite … … 34 35 IExtFileStore, IFileStoreNameChooser) 35 36 from waeup.kofa.students.interfaces import IStudentsUtils 37 from waeup.kofa.browser.tests.test_pdf import samples_dir 36 38 from kofacustom.edopoly.testing import FunctionalLayer 37 39 … … 44 46 def test_dummytest(self): 45 47 return 48 49 class StudentUITests(StudentsFullSetup): 50 """Tests for customized student class views and pages 51 """ 52 53 layer = FunctionalLayer 54 55 def setUp(self): 56 super(StudentUITests, self).setUp() 57 58 59 def test_medical_laboratory_form(self): 60 self.browser.open(self.login_path) 61 self.browser.getControl(name="form.login").value = self.student_id 62 self.browser.getControl(name="form.password").value = 'spwd' 63 self.browser.getControl("Login").click() 64 self.assertRaises( 65 LinkNotFoundError, 66 self.browser.getLink, 'Download medical laboratory request form') 67 # Add medical fee payment ticket 68 self.app['configuration']['2004'].medical = 180.0 69 payment = createObject('waeup.StudentOnlinePayment') 70 payment.p_category = u'medical' 71 payment.p_session = self.student.current_session 72 payment.p_id = u'anyid' 73 payment.p_state = u'paid' 74 self.student['payments']['anykey'] = payment 75 self.browser.open(self.student_path) 76 self.browser.getLink("Download medical laboratory request form").click() 77 self.assertEqual(self.browser.headers['Status'], '200 Ok') 78 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 79 path = os.path.join(samples_dir(), 'medical_laboratory_form.pdf') 80 open(path, 'wb').write(self.browser.contents) 81 print "Sample PDF medical_laboratory_form.pdf written to %s" % path
Note: See TracChangeset for help on using the changeset viewer.