- Timestamp:
- 13 Jan 2014, 08:55:58 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/tests/test_browser.py
r10379 r10899 43 43 from kofacustom.nigeria.applicants.batching import NigeriaApplicantProcessor 44 44 45 session_1 = datetime.datetime.now().year - 2 46 app_container_name = u'app%s' % session_1 47 pgft_container_name = u'pgft%s' % session_1 45 48 46 49 class ApplicantUITest(FunctionalTestCase): … … 68 71 # Add an two different applicants containers 69 72 self.pgcontainer = ApplicantsContainer() 70 self.pgcontainer.code = u'pgft2011'73 self.pgcontainer.code = pgft_container_name 71 74 self.pgcontainer.prefix = u'pgft' 72 75 self.pgcontainer.application_category = u'pg_ft' 73 self.pgcontainer.year = 201176 self.pgcontainer.year = session_1 74 77 self.pgcontainer.application_fee = 300.0 75 self.pgcontainer.title = u'This is the pgft2011 container'76 self.app['applicants'][ 'pgft2011'] = self.pgcontainer78 self.pgcontainer.title = u'This is the %s container' % pgft_container_name 79 self.app['applicants'][pgft_container_name] = self.pgcontainer 77 80 self.ugcontainer = ApplicantsContainer() 78 self.ugcontainer.code = u'putme2011'79 self.ugcontainer.prefix = u' putme'81 self.ugcontainer.code = app_container_name 82 self.ugcontainer.prefix = u'app' 80 83 self.ugcontainer.application_category = u'basic' 81 self.ugcontainer.year = 201184 self.ugcontainer.year = session_1 82 85 self.ugcontainer.application_fee = 200.0 83 self.ugcontainer.title = u'This is the app2011 container'84 self.app['applicants'][ 'app2011'] = self.ugcontainer86 self.ugcontainer.title = u'This is the %s container' % app_container_name 87 self.app['applicants'][app_container_name] = self.ugcontainer 85 88 86 89 self.ugcontainer.mode = 'update' … … 113 116 pgapplicant.firstname = u'Anna' 114 117 pgapplicant.lastname = u'Post' 115 self.app['applicants'][ 'pgft2011'].addApplicant(pgapplicant)118 self.app['applicants'][pgft_container_name].addApplicant(pgapplicant) 116 119 self.pgapplication_number = pgapplicant.application_number 117 self.pgapplicant = self.app['applicants'][ 'pgft2011'][120 self.pgapplicant = self.app['applicants'][pgft_container_name][ 118 121 self.pgapplication_number] 119 122 … … 121 124 ugapplicant.firstname = u'Klaus' 122 125 ugapplicant.lastname = u'Under' 123 self.app['applicants'][ 'app2011'].addApplicant(ugapplicant)126 self.app['applicants'][app_container_name].addApplicant(ugapplicant) 124 127 self.ugapplication_number = ugapplicant.application_number 125 self.ugapplicant = self.app['applicants'][ 'app2011'][128 self.ugapplicant = self.app['applicants'][app_container_name][ 126 129 self.ugapplication_number] 127 self.pgapplicant_path = ('http://localhost/app/applicants/ pgft2011/%s'128 % self.pgapplication_number)129 self.ugapplicant_path = ('http://localhost/app/applicants/ app2011/%s'130 % self.ugapplication_number)130 self.pgapplicant_path = ('http://localhost/app/applicants/%s/%s' 131 % (pgft_container_name, self.pgapplication_number)) 132 self.ugapplicant_path = ('http://localhost/app/applicants/%s/%s' 133 % (app_container_name, self.ugapplication_number)) 131 134 132 135 self.browser = Browser() 133 136 self.browser.handleErrors = False 137 138 configuration = SessionConfiguration() 139 configuration.academic_session = session_1 140 configuration.application_fee = 200.0 141 self.app['configuration'].addSessionConfiguration(configuration) 134 142 135 143 def tearDown(self): … … 213 221 payment_id = self.ugapplicant.keys()[0] 214 222 payment = self.ugapplicant[payment_id] 215 self.assertEqual(payment.p_item,'This is the app2011 container')216 self.assertEqual(payment.p_session, 2011)223 self.assertEqual(payment.p_item,'This is the %s container' % app_container_name) 224 self.assertEqual(payment.p_session,session_1) 217 225 self.assertEqual(payment.p_category,'application') 218 226 self.assertEqual(payment.amount_auth, 200.0) … … 235 243 payment_id = self.pgapplicant.keys()[0] 236 244 payment = self.pgapplicant[payment_id] 237 self.assertEqual(payment.p_item,'This is the pgft2011 container')238 self.assertEqual(payment.p_session, 2011)245 self.assertEqual(payment.p_item,'This is the %s container' % pgft_container_name) 246 self.assertEqual(payment.p_session,session_1) 239 247 self.assertEqual(payment.p_category,'application') 240 248 self.assertEqual(payment.amount_auth, 300.0) … … 265 273 self.ugapplicant.reg_number = u'1234' 266 274 notify(grok.ObjectModifiedEvent(self.ugapplicant)) 267 self.browser.open('http://localhost/app/applicants/ app2011/')275 self.browser.open('http://localhost/app/applicants/%s/' % app_container_name) 268 276 self.browser.getLink("Register for application").click() 269 277 # Fill the edit form with suitable values … … 291 299 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 292 300 manage_path = 'http://localhost/app/applicants/%s/%s/%s' % ( 293 'app2011', self.ugapplicant.application_number, 'manage')301 app_container_name, self.ugapplicant.application_number, 'manage') 294 302 self.browser.open(manage_path) 295 303 self.fill_correct_values() … … 362 370 'password,phone,pp_school,presently_inst,reg_number,' 363 371 'result_uploaded,screening_date,screening_score,' 364 'screening_venue,sex,state,student_id,suspended,container_code\r\n' 372 'screening_venue,sex,special_application,' 373 'state,student_id,suspended,container_code\r\n' 365 374 ',dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,' 366 375 'Anna M. Tester,anna@sample.com,,,,,,,,,,,Anna,' … … 368 377 ',,,,,,,,,Tester,,0,M.,NG,"Some notice\nin lines.",,,' 369 378 'any password,+234-123-12345#,,,123456,,' 370 '"Saturday, 16th June 2012 2:00:00 PM",98,Exam Room,f, initialized,,'379 '"Saturday, 16th June 2012 2:00:00 PM",98,Exam Room,f,,initialized,,' 371 380 '0,dp2011\r\n') 372 381 # We can import the same file if we ignore some columns. … … 387 396 'reg_number','result_uploaded', 388 397 'screening_date','screening_score','screening_venue','sex', 398 'special_application', 389 399 'state','student_id','suspended','container_code'], 390 400 mode='create') … … 411 421 'nysc_year','password','phone','pp_school','presently_inst', 412 422 'reg_number','result_uploaded','screening_date','screening_score', 413 'screening_venue','sex', 423 'screening_venue','sex','special_application', 414 424 'state','student_id','suspended','ignore_container_code'], 415 425 mode='update')
Note: See TracChangeset for help on using the changeset viewer.