- Timestamp:
- 2 May 2020, 20:07:43 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests/test_browser.py
r15313 r16078 21 21 """ 22 22 import os 23 import datetime 24 import pytz 23 25 from StringIO import StringIO 24 from datetime import datetime25 26 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 26 27 from zope.securitypolicy.interfaces import IPrincipalRoleManager 28 from zope.component import createObject, getUtility 29 from waeup.kofa.configuration import SessionConfiguration 30 from waeup.kofa.interfaces import IUserAccount 27 31 from waeup.kofa.browser.tests.test_pdf import samples_dir 28 32 from waeup.kofa.applicants.container import ApplicantsContainer … … 31 35 from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup, PH_LEN 32 36 33 session_1 = datetime. now().year - 237 session_1 = datetime.datetime.now().year - 2 34 38 SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg') 35 39 … … 127 131 self.assertTrue('<span>55</span>' in self.browser.contents) 128 132 configuration = CustomSessionConfiguration() 129 configuration.academic_session = datetime. now().year - 2133 configuration.academic_session = datetime.datetime.now().year - 2 130 134 self.app['configuration'].addSessionConfiguration(configuration) 131 135 # Admission checking fee is 0, thus admission checking payment … … 290 294 open(path, 'wb').write(self.browser.contents) 291 295 print "Sample ictwk_application_slip.pdf written to %s" % path 296 297 def test_transcript_payment(self): 298 configuration = SessionConfiguration() 299 configuration.academic_session = session_1 300 self.app['configuration'].addSessionConfiguration(configuration) 301 # Add special application container 302 applicantscontainer = ApplicantsContainer() 303 applicantscontainer.year = session_1 304 applicantscontainer.application_fee = 200.0 305 applicantscontainer.code = u'trans1234' 306 applicantscontainer.prefix = 'trans' 307 applicantscontainer.title = u'This is a trans container' 308 applicantscontainer.application_category = 'no' 309 applicantscontainer.mode = 'create' 310 applicantscontainer.strict_deadline = True 311 applicantscontainer.with_picture = False 312 delta = datetime.timedelta(days=10) 313 applicantscontainer.startdate = datetime.datetime.now(pytz.utc) - delta 314 applicantscontainer.enddate = datetime.datetime.now(pytz.utc) + delta 315 self.app['applicants']['trans1234'] = applicantscontainer 316 # Add an applicant 317 applicant = createObject('waeup.Applicant') 318 # reg_number is the only field which has to be preset here 319 # because managers are allowed to edit this required field 320 applicant.reg_number = u'12345' 321 self.app['applicants']['trans1234'].addApplicant(applicant) 322 IUserAccount( 323 self.app['applicants']['trans1234'][ 324 applicant.application_number]).setPassword('apwd') 325 # Login 326 self.browser.open(self.login_path) 327 self.browser.getControl( 328 name="form.login").value = applicant.applicant_id 329 self.browser.getControl(name="form.password").value = 'apwd' 330 self.browser.getControl("Login").click() 331 self.browser.getLink("Application record").click() 332 self.browser.getControl(name="form.date_of_birth").value = '09/09/1988' 333 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 334 self.browser.getControl(name="form.nationality").value = ['NG'] 335 self.browser.getControl(name="form.firstname").value = 'Angela' 336 self.browser.getControl(name="form.lastname").value = 'Merkel' 337 self.browser.getControl(name="form.sex").value = ['f'] 338 self.browser.getControl(name="form.no_copies").value = ['3'] 339 self.browser.getControl(name="form.course_studied").value = ['CERT1'] 340 self.browser.getControl(name="form.matric_number").value = '234' 341 self.browser.getControl(name="form.place_of_birth").value = 'Bochum' 342 self.browser.getControl(name="form.dispatch_address").value = 'Kuensche' 343 self.browser.getControl(name="form.perm_address").value = 'Kuensche' 344 self.browser.getControl(name="form.entry_mode").value = ['ug_ft'] 345 self.browser.getControl(name="form.entry_session").value = ['2014'] 346 self.browser.getControl(name="form.end_session").value = ['2015'] 347 self.browser.getControl(name="form.phone.country").value = ['+234'] 348 self.browser.getControl(name="form.phone.ext").value = '5678' 349 self.browser.getControl("Save").click() 350 self.browser.getControl("Add online payment ticket").click() 351 self.assertTrue('Payment ticket created' in self.browser.contents) 352 self.assertTrue('<span>200.0</span>' in self.browser.contents) 353 self.assertEqual(applicant.values()[0].amount_auth, 200.0) 354 return
Note: See TracChangeset for help on using the changeset viewer.