- Timestamp:
- 29 Jun 2011, 08:42:32 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py
r6482 r6483 53 53 app = University() 54 54 self.dc_root = tempfile.mkdtemp() 55 app['datacenter'].setStoragePath(self.dc_root) 56 57 # Prepopulate the ZODB... 58 self.getRootFolder()['app'] = app 59 # we add the site immediately after creation to the 60 # ZODB. Catalogs and other local utilities are not setup 61 # before that step. 62 self.app = self.getRootFolder()['app'] 63 # Set site here. Some of the following setup code might need 64 # to access grok.getSite() and should get our new app then 65 setSite(app) 66 55 67 self.root_path = 'http://localhost/app/applicants/' 56 68 self.container_path = 'http://localhost/app/applicants/app2009/' … … 62 74 applicantscontainer.year = 2009 63 75 applicantscontainer.application_category = 'basic' 64 app['applicants']['app2009'] = applicantscontainer76 self.app['applicants']['app2009'] = applicantscontainer 65 77 66 78 # Populate university 67 faculty = Faculty() 68 department = Department() 69 cert_container = CertificateContainer() 70 certificate = Certificate(code='CERT1') 79 certificate = createObject('waeup.Certificate') 80 certificate.code = 'CERT1' 71 81 certificate.application_category = 'basic' 72 app['faculties']['fac1'] = faculty73 app['faculties']['fac1']['dep1'] = department74 app['faculties']['fac1']['dep1'].certificates = cert_container75 app['faculties']['fac1']['dep1'].certificates['CERT1'] = certificate82 self.app['faculties']['fac1'] = Faculty() 83 self.app['faculties']['fac1']['dep1'] = Department() 84 self.app['faculties']['fac1']['dep1'].certificates.addCertificate( 85 certificate) 76 86 77 87 # Put the prepopulated site into test ZODB and prepare test 78 88 # browser 79 self.getRootFolder()['app'] = app80 self.app = self.getRootFolder()['app']81 setSite(self.app)82 89 self.browser = Browser() 83 90 self.browser.handleErrors = False 84 91 85 92 # Create 5 access codes with prefix'FOO' and cost 9.99 each 86 pin_container = self. getRootFolder()['app']['accesscodes']93 pin_container = self.app['accesscodes'] 87 94 pin_container.createBatch( 88 95 datetime.now(), 'some_userid', 'APP', 9.99, 5) … … 92 99 parts = self.existing_pin.split('-')[1:] 93 100 self.existing_series, self.existing_number = parts 94 self.browser.handleErrors = False95 101 96 102 # Add an applicant … … 99 105 self.applicant.access_code = self.pin_applicant 100 106 app['applicants']['app2009'][self.pin_applicant] = self.applicant 107 return 101 108 102 109 def tearDown(self): … … 206 213 self.browser.getControl(name="form.date_of_birth").value = 'Jonathan' 207 214 self.browser.getControl(name="form.lga").value = ['foreigner'] 208 self.browser.getControl(name="form.sex").value = ['m ale']215 self.browser.getControl(name="form.sex").value = ['m'] 209 216 self.browser.getControl("Save").click() 210 217 self.assertTrue('Required input is missing' in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.