Changeset 13803 for main/waeup.ikoba/trunk/src/waeup/ikoba/browser/tests
- Timestamp:
- 6 Apr 2016, 05:04:26 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/browser/tests/test_browser.py
r13802 r13803 30 30 from waeup.ikoba.testing import FunctionalLayer, FunctionalTestCase 31 31 from waeup.ikoba.app import Company 32 from waeup.ikoba.interfaces import IJobManager 32 from waeup.ikoba.interfaces import IJobManager, IUserAccount 33 33 from waeup.ikoba.tests.test_async import FunctionalAsyncTestCase 34 34 … … 160 160 return 161 161 162 163 class SupplementaryBrowserTests(CompanySetup): 164 # These are additional tests to browser.txt 165 166 def test_suspended_officer(self): 167 self.app['users'].addUser( 168 'officer', 'secret', title='Bob Officer', email='aa@aa.ng') 169 # Officer can't login if their password is not set 170 self.app['users']['officer'].password = None 171 self.browser.open('http://localhost/app/login') 172 self.browser.getControl(name="form.login").value = 'officer' 173 self.browser.getControl(name="form.password").value = 'secret' 174 self.browser.getControl("Login").click() 175 self.assertTrue( 176 'You entered invalid credentials.' in self.browser.contents) 177 # We set the password again 178 IUserAccount( 179 self.app['users']['officer']).setPassword('secret') 180 # Officers can't login if their account is suspended/deactivated 181 self.app['users']['officer'].suspended = True 182 self.browser.open('http://localhost/app/login') 183 self.browser.getControl(name="form.login").value = 'officer' 184 self.browser.getControl(name="form.password").value = 'secret' 185 self.browser.getControl("Login").click() 186 self.assertMatches( 187 '...but yor account has been temporarily deactivated...', 188 self.browser.contents) 189 self.assertFalse("Bob Officer" in self.browser.contents) 190 self.app['users']['officer'].suspended = False 191 self.browser.open('http://localhost/app/login') 192 self.browser.getControl(name="form.login").value = 'officer' 193 self.browser.getControl(name="form.password").value = 'secret' 194 self.browser.getControl("Login").click() 195 self.assertMatches( 196 '...You logged in...', self.browser.contents) 197 self.assertTrue("Bob Officer" in self.browser.contents) 198 self.browser.getLink("Logout").click() 199 # Suspended accounts are marked 200 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 201 self.browser.open('http://localhost/app/users') 202 self.assertFalse('(suspended)' in self.browser.contents) 203 self.app['users']['officer'].suspended = True 204 self.browser.open('http://localhost/app/users') 205 self.assertTrue( 206 '<span style="color:red">(suspended)</span>' 207 in self.browser.contents) 208 self.browser.open('http://localhost/app/users/officer') 209 self.assertTrue( 210 'This account has been suspended.' in self.browser.contents) 211 self.app['users']['officer'].suspended = False 212 self.browser.open('http://localhost/app/users/officer') 213 self.assertFalse( 214 'This account has been suspended.' in self.browser.contents) 215 return
Note: See TracChangeset for help on using the changeset viewer.