Changeset 5893
- Timestamp:
- 30 Mar 2011, 10:32:29 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py
r5892 r5893 47 47 self.dc_root = tempfile.mkdtemp() 48 48 app['datacenter'].setStoragePath(self.dc_root) 49 self.login_path = 'http://localhost/app/applicants/testapplicants/login' 49 50 50 51 # Add an applicants container where we can login (or not) … … 63 64 def test_anonymous_access(self): 64 65 # Anonymous users can access a login page 65 path = 'http://localhost/app/applicants/testapplicants/login' 66 self.browser.open(path) 66 self.browser.open(self.login_path) 67 67 self.assertEqual(self.browser.headers['Status'], '200 Ok') 68 68 return … … 70 70 def test_anonymous_invalid_creds(self): 71 71 # Anonymous users giving invalid credentials stay at the page 72 path = 'http://localhost/app/applicants/testapplicants/login' 73 self.browser.open(path) 72 self.browser.open(self.login_path) 74 73 # We do not give credentials but send the form as-is 75 74 submit = self.browser.getControl(name='SUBMIT') 76 75 submit.click() 77 76 # We are still at the same page... 78 self.assertEqual( 79 self.browser.url, 80 'http://localhost/app/applicants/testapplicants/login' 81 ) 77 self.assertEqual(self.browser.url, self.login_path) 82 78 self.assertEqual(self.browser.headers['Status'], '200 Ok') 83 79 return … … 85 81 def test_anonymous_invalid_creds_warning(self): 86 82 # Entering wrong credentials will yield a warning 87 path = 'http://localhost/app/applicants/testapplicants/login' 88 self.browser.open(path) 83 self.browser.open(self.login_path) 89 84 # We do not give credentials but send the form as-is 90 85 submit = self.browser.getControl(name='SUBMIT') … … 96 91 def test_manager_no_warnings(self): 97 92 # Browsing the login screen as a manager, won't raise warnings 98 path = 'http://localhost/app/applicants/testapplicants/login'99 93 # Authenticate ourself as manager 100 94 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 101 self.browser.open( path)95 self.browser.open(self.login_path) 102 96 # Submit the form w/o any credentials 103 97 self.browser.getControl(name="SUBMIT").click() … … 108 102 def test_manager_no_redirect(self): 109 103 # Browsing the login screen as a manager won't trigger a redirect 110 path = 'http://localhost/app/applicants/testapplicants/login'111 104 # Authenticate ourself as manager 112 105 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 113 self.browser.open( path)106 self.browser.open(self.login_path) 114 107 # Submit the form w/o any credentials 115 108 self.browser.getControl(name="SUBMIT").click() 116 self.assertEqual( 117 self.browser.url, 118 'http://localhost/app/applicants/testapplicants/login' 119 ) 109 self.assertEqual(self.browser.url, self.login_path) 120 110 return 121 111
Note: See TracChangeset for help on using the changeset viewer.