Changeset 6482 for main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests
- Timestamp:
- 27 Jun 2011, 16:59:12 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py
r6479 r6482 30 30 from zope.app.testing.functional import HTTPCaller as http 31 31 from zope.component import createObject 32 from zope.component.hooks import setSite, clearSite 32 33 from zope.security.interfaces import Unauthorized 33 34 from zope.testbrowser.testing import Browser … … 36 37 from waeup.sirp.applicants.container import ApplicantsContainer 37 38 from waeup.sirp.applicants.applicants import Applicant 38 39 from waeup.sirp.university.faculty import Faculty 40 from waeup.sirp.university.department import Department 41 from waeup.sirp.university.certificate import Certificate 42 from waeup.sirp.university.certificatecontainer import CertificateContainer 39 43 40 44 class ApplicantsUITests(FunctionalTestCase): … … 60 64 app['applicants']['app2009'] = applicantscontainer 61 65 66 # Populate university 67 faculty = Faculty() 68 department = Department() 69 cert_container = CertificateContainer() 70 certificate = Certificate(code='CERT1') 71 certificate.application_category = 'basic' 72 app['faculties']['fac1'] = faculty 73 app['faculties']['fac1']['dep1'] = department 74 app['faculties']['fac1']['dep1'].certificates = cert_container 75 app['faculties']['fac1']['dep1'].certificates['CERT1'] = certificate 76 62 77 # Put the prepopulated site into test ZODB and prepare test 63 78 # browser 64 79 self.getRootFolder()['app'] = app 80 self.app = self.getRootFolder()['app'] 81 setSite(self.app) 65 82 self.browser = Browser() 66 83 self.browser.handleErrors = False … … 78 95 79 96 # Add an applicant 80 applicant = Applicant()97 self.applicant = Applicant() 81 98 self.pin_applicant = unicode(self.pins[1]) 82 applicant.access_code = self.pin_applicant83 app['applicants']['app2009'][self.pin_applicant] = applicant99 self.applicant.access_code = self.pin_applicant 100 app['applicants']['app2009'][self.pin_applicant] = self.applicant 84 101 85 102 def tearDown(self): 86 103 super(ApplicantsUITests, self).tearDown() 104 clearSite() 87 105 shutil.rmtree(self.dc_root) 88 106 … … 98 116 'Manage' in self.browser.contents) 99 117 return 118 119 def test_manage_cert_access(self): 120 # Managers can access CERT1 121 cert_path = 'http://localhost/app/faculties/fac1/dep1/certificates/CERT1' 122 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 123 self.browser.open(cert_path) 124 self.assertEqual(self.browser.headers['Status'], '200 Ok') 100 125 101 126 def test_manage_access(self): … … 130 155 self.browser.getControl(name="form.prefix").value = ['app'] 131 156 self.browser.getControl(name="form.year").value = ['2010'] 132 self.browser.getControl(name="form.provider").value = ['waeup.sirp.applicants.ApplicantsContainer'] 157 self.browser.getControl(name="form.provider").value = [ 158 'waeup.sirp.applicants.ApplicantsContainer'] 133 159 self.browser.getControl(name="form.ac_prefix").value = ['APP'] 134 160 self.browser.getControl(name="form.application_category").value = ['basic'] … … 175 201 self.browser.open(self.applicant_manage_path) 176 202 self.assertEqual(self.browser.headers['Status'], '200 Ok') 177 self.browser.getControl(name="form.firstname").value = 'Jonathan' 203 self.browser.getControl(name="form.firstname").value = 'John' 204 self.browser.getControl(name="form.lastname").value = 'Tester' 205 self.browser.getControl(name="form.course1").value = ['CERT1'] 206 self.browser.getControl(name="form.date_of_birth").value = 'Jonathan' 207 self.browser.getControl(name="form.lga").value = ['foreigner'] 208 self.browser.getControl(name="form.sex").value = ['male'] 178 209 self.browser.getControl("Save").click() 179 210 self.assertTrue('Required input is missing' in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.