- Timestamp:
- 18 Sep 2019, 16:51:44 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.dspg/trunk/src/kofacustom/dspg/applicants/tests/test_browser.py
r14887 r15592 35 35 from waeup.kofa.university.faculty import Faculty 36 36 from waeup.kofa.university.department import Department 37 from waeup.kofa.interfaces import IUserAccount 38 from waeup.kofa.configuration import SessionConfiguration 37 39 from waeup.kofa.testing import FunctionalTestCase 38 40 from waeup.kofa.applicants.tests.test_batching import ApplicantImportExportSetup … … 75 77 #self.ndftcontainer.title = u'This is the %s container' % ndftcontainer_name 76 78 self.app['applicants'][ndftcontainer_name] = self.ndftcontainer 79 80 self.login_path = 'http://localhost/app/login' 77 81 78 82 delta = datetime.timedelta(days=10) … … 122 126 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 123 127 128 def prepare_special_container(self): 129 # Add special application container 130 container_name = u'special%s' % session 131 applicantscontainer = ApplicantsContainer() 132 applicantscontainer.code = container_name 133 applicantscontainer.prefix = 'special' 134 applicantscontainer.year = session 135 applicantscontainer.with_picture = False 136 applicantscontainer.title = u'This is a special app container' 137 applicantscontainer.application_category = 'no' 138 applicantscontainer.mode = 'create' 139 applicantscontainer.strict_deadline = True 140 delta = datetime.timedelta(days=10) 141 applicantscontainer.startdate = datetime.datetime.now(pytz.utc) - delta 142 applicantscontainer.enddate = datetime.datetime.now(pytz.utc) + delta 143 self.app['applicants'][container_name] = applicantscontainer 144 # Add an applicant 145 applicant = createObject('waeup.Applicant') 146 # reg_number is the only field which has to be preset here 147 # because managers are allowed to edit this required field 148 applicant.reg_number = u'12345' 149 self.special_applicant = applicant 150 self.app['applicants'][container_name].addApplicant(applicant) 151 IUserAccount( 152 self.app['applicants'][container_name][ 153 applicant.application_number]).setPassword('apwd') 154 # Add session configuration object 155 self.configuration = SessionConfiguration() 156 self.configuration.academic_session = session 157 #self.configuration.transcript_fee = 200.0 158 self.configuration.clearance_fee = 300.0 159 self.app['configuration'].addSessionConfiguration(self.configuration) 160 124 161 def test_manage_and_view_applicant(self): 125 162 # Managers can manage ndft applicants. … … 154 191 self.assertMatches('...Form has been saved...', self.browser.contents) 155 192 return 193 194 def test_special_application(self): 195 self.prepare_special_container() 196 # Login 197 self.browser.open(self.login_path) 198 self.browser.getControl( 199 name="form.login").value = self.special_applicant.applicant_id 200 self.browser.getControl(name="form.password").value = 'apwd' 201 self.browser.getControl("Login").click() 202 applicant_path = self.browser.url 203 self.browser.getLink("Edit application record").click() 204 self.browser.getControl(name="form.firstname").value = 'John' 205 self.browser.getControl(name="form.middlename").value = 'Anthony' 206 self.browser.getControl(name="form.lastname").value = 'Tester' 207 self.browser.getControl(name="form.special_application").value = [ 208 'carryover4'] 209 self.browser.getControl(name="form.date_of_birth").value = '09/09/1988' 210 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 211 self.browser.getControl(name="form.certificate").value = ['CERT1'] 212 self.browser.getControl(name="form.carryover_courses_1").value = 'Test Course 1 - TCO1' 213 self.browser.getControl(name="form.carryover_courses_2").value = 'Test Course 2 - TCO2 \nTest Course 3 - TCO3' 214 self.browser.getControl(name="form.grad_year").value = ['2015'] 215 self.configuration.carryover4_fee = 5000.0 216 self.browser.getControl("Save").click() 217 self.browser.getControl("Add online payment ticket").click() 218 self.assertMatches('...Payment ticket created...', 219 self.browser.contents) 220 self.assertTrue( 221 '<span>4 Carry-Over Courses</span>' in self.browser.contents) 222 self.assertTrue( 223 'This is a special app container' in self.browser.contents) 224 self.assertTrue( 225 '<span>5000.0</span>' in self.browser.contents) 226 self.assertEqual(len(self.special_applicant.keys()), 1) 227 payment_id = self.special_applicant.keys()[0] 228 # The applicant's workflow state is paid ... 229 self.special_applicant.payments[0].approveApplicantPayment() 230 self.assertEqual(self.special_applicant.state, 'paid') 231 self.browser.open(applicant_path + '/edit') 232 self.browser.getControl("Finally Submit").click() 233 self.browser.open(applicant_path + '/' + payment_id) 234 self.browser.getLink("Download payment slip").click() 235 self.assertEqual(self.browser.headers['Content-Type'], 236 'application/pdf') 237 path = os.path.join(samples_dir(), 'special_payment_slip.pdf') 238 open(path, 'wb').write(self.browser.contents) 239 print "Sample PDF clearance_slip.pdf written to %s" % path 240 self.browser.open(applicant_path) 241 self.browser.getLink("Download application slip").click() 242 path = os.path.join(samples_dir(), 'application_slip.pdf') 243 open(path, 'wb').write(self.browser.contents) 244 print "Sample application_slip.pdf written to %s" % path 156 245 157 246 class ApplicantExporterTest(ApplicantImportExportSetup):
Note: See TracChangeset for help on using the changeset viewer.