Changeset 11788 for main/waeup.uniben/trunk/src/waeup/uniben/applicants
- Timestamp:
- 30 Aug 2014, 07:35:30 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests/test_browser.py
r11736 r11788 20 20 """ 21 21 from StringIO import StringIO 22 from datetime import datetime 23 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 22 24 from zope.securitypolicy.interfaces import IPrincipalRoleManager 23 25 from waeup.uniben.testing import FunctionalLayer 26 from waeup.uniben.configuration import CustomSessionConfiguration 24 27 from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup, PH_LEN 25 28 … … 28 31 29 32 layer = FunctionalLayer 33 34 #def setUp(self): 35 # super(CustomApplicantUITests, self).setUp() 36 # return 30 37 31 38 def test_applicant_access(self): … … 100 107 self.browser.headers['content-type'], 'image/jpeg') 101 108 self.assertEqual(len(self.browser.contents), 31) 109 110 def test_pay_admission_checking_fee(self): 111 IWorkflowState(self.applicant).setState('admitted') 112 self.applicant.screening_score = 55 113 self.applicant.course_admitted = self.certificate 114 self.login() 115 # SessionConfiguration is not set, thus admission checking payment 116 # is not necessary. Screening results and course admitted are visible. 117 self.assertFalse( 118 'Add admission checking payment ticket' in self.browser.contents) 119 self.assertTrue('<a href="http://localhost/app/faculties/fac1/dep1/certificates/CERT1">CERT1 - Unnamed Certificate</a>' in self.browser.contents) 120 self.assertTrue('55' in self.browser.contents) 121 configuration = CustomSessionConfiguration() 122 configuration.academic_session = datetime.now().year - 2 123 self.app['configuration'].addSessionConfiguration(configuration) 124 # Admission checking fee is 0, thus admission checking payment 125 # is not necessary. Screening results and course admitted are visible. 126 self.browser.open(self.view_path) 127 self.assertFalse( 128 'Add admission checking payment ticket' in self.browser.contents) 129 self.assertTrue('<a href="http://localhost/app/faculties/fac1/dep1/certificates/CERT1">CERT1 - Unnamed Certificate</a>' in self.browser.contents) 130 self.assertTrue('55' in self.browser.contents) 131 configuration.admchecking_fee = 22.0 132 # Admission checking payment button is now visible, but screening results 133 # and course admitted are not. 134 self.browser.open(self.view_path) 135 self.assertTrue( 136 'Add admission checking payment ticket' in self.browser.contents) 137 self.assertFalse('<a href="http://localhost/app/faculties/fac1/dep1/certificates/CERT1">CERT1 - Unnamed Certificate</a>' in self.browser.contents) 138 self.assertFalse('55' in self.browser.contents) 139 # Application slip can't be downloaded 140 self.assertFalse('Download application slip' in self.browser.contents) 141 slip_path = self.view_path + '/application_slip.pdf' 142 self.browser.open(slip_path) 143 self.assertTrue( 144 'Please pay admission checking fee before trying to download' 145 in self.browser.contents) 146 # Pay admission checking fee. 147 self.browser.getControl("Add admission checking").click() 148 p_id = self.applicant.keys()[0] 149 self.applicant[p_id].p_state = 'paid' 150 # Screening results and course admitted are visible after payment. 151 self.browser.open(self.view_path) 152 self.assertFalse( 153 'Add admission checking payment ticket' in self.browser.contents) 154 self.assertTrue('<a href="http://localhost/app/faculties/fac1/dep1/certificates/CERT1">CERT1 - Unnamed Certificate</a>' in self.browser.contents) 155 self.assertTrue('55' in self.browser.contents) 156 # Application slip can be downloaded again. 157 self.browser.getLink("Download application slip").click() 158 self.assertEqual(self.browser.headers['Status'], '200 Ok') 159 self.assertEqual(self.browser.headers['Content-Type'], 160 'application/pdf') 161 return
Note: See TracChangeset for help on using the changeset viewer.