Changeset 8405 for main/waeup.kofa/trunk/src
- Timestamp:
- 10 May 2012, 05:25:13 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
r8388 r8405 76 76 self.login_path = 'http://localhost/app/login' 77 77 self.root_path = 'http://localhost/app/applicants' 78 self.search_path = 'http://localhost/app/applicants/search' 78 79 self.manage_root_path = self.root_path + '/@@manage' 79 80 self.add_container_path = self.root_path + '/@@add' … … 204 205 self.assertEqual(self.browser.headers['Status'], '200 Ok') 205 206 self.assertEqual(self.browser.url, self.manage_root_path) 207 return 208 209 def test_search(self): 210 # Managers can access the manage pages of applicants root 211 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 212 self.browser.open(self.manage_path) 213 self.fill_correct_values() 214 self.browser.getControl("Save").click() 215 self.browser.open(self.root_path) 216 self.assertTrue('Manage application section' in self.browser.contents) 217 # There is a search link 218 link = self.browser.getLink('Search applicants') 219 link.click() 220 self.assertEqual(self.browser.headers['Status'], '200 Ok') 221 # We can find an applicant ... 222 # ... via his name 223 self.browser.getControl(name="searchtype").value = ['fullname'] 224 self.browser.getControl(name="searchterm").value = 'John' 225 self.browser.getControl("Search").click() 226 self.assertTrue('John Tester' in self.browser.contents) 227 self.browser.getControl(name="searchtype").value = ['fullname'] 228 self.browser.getControl(name="searchterm").value = 'Tester' 229 self.browser.getControl("Search").click() 230 self.assertTrue('John Tester' in self.browser.contents) 231 self.browser.open(self.search_path) 232 # ... and via his reg_number ... 233 self.browser.getControl(name="searchtype").value = ['reg_number'] 234 self.browser.getControl(name="searchterm").value = '2345' 235 self.browser.getControl("Search").click() 236 self.assertFalse('John Tester' in self.browser.contents) 237 self.browser.getControl(name="searchtype").value = ['reg_number'] 238 self.browser.getControl(name="searchterm").value = '1234' 239 self.browser.getControl("Search").click() 240 self.assertTrue('John Tester' in self.browser.contents) 241 # ... and not via his application_number ... 242 self.browser.getControl(name="searchtype").value = ['applicant_id'] 243 self.browser.getControl( 244 name="searchterm").value = self.applicant.application_number 245 self.browser.getControl("Search").click() 246 self.assertFalse('John Tester' in self.browser.contents) 247 # ... but ia his applicant_id ... 248 self.browser.getControl(name="searchtype").value = ['applicant_id'] 249 self.browser.getControl( 250 name="searchterm").value = self.applicant.applicant_id 251 self.browser.getControl("Search").click() 252 self.assertTrue('John Tester' in self.browser.contents) 253 # ... and via his email 254 self.browser.getControl(name="searchtype").value = ['email'] 255 self.browser.getControl(name="searchterm").value = 'xx@yy.zz' 256 self.browser.getControl("Search").click() 257 self.assertTrue('John Tester' in self.browser.contents) 206 258 return 207 259 … … 408 460 self.browser.headers['content-length'], str(PH_LEN)) 409 461 410 def test_ edit_applicant(self):462 def test_applicant_access(self): 411 463 # Applicants can edit their record 412 464 self.browser.open(self.login_path) … … 418 470 self.browser.getControl("Save").click() 419 471 self.assertMatches('...Form has been saved...', self.browser.contents) 472 # Applicants don't see manage and search links ... 473 self.browser.open(self.root_path) 474 self.assertEqual(self.browser.headers['Status'], '200 Ok') 475 self.assertFalse('Search' in self.browser.contents) 476 self.assertFalse('Manage application section' in self.browser.contents) 477 # ... and can't access the manage page 478 self.assertRaises( 479 Unauthorized, self.browser.open, self.manage_path) 420 480 return 421 481
Note: See TracChangeset for help on using the changeset viewer.