- Timestamp:
- 6 Apr 2016, 10:27:11 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/browser/tests/test_browser.py
r13804 r13806 22 22 import tempfile 23 23 import os 24 import grok 24 25 from zc.async.testing import wait_for_result 25 26 from zope.component import createObject, getUtility … … 215 216 return 216 217 218 def test_maintenance_mode(self): 219 config = grok.getSite()['configuration'] 220 self.app['users'].addUser( 221 'officer', 'secret', title='Bob Officer', email='bob@abcd.ng') 222 self.browser.open('http://localhost/app/login') 223 self.browser.getControl(name="form.login").value = 'officer' 224 self.browser.getControl(name="form.password").value = 'secret' 225 self.browser.getControl("Login").click() 226 # Officer logged in. 227 self.assertMatches('...You logged in...', self.browser.contents) 228 self.assertTrue("Bob Officer" in self.browser.contents) 229 # If maintenance mode is enabled, officer is immediately logged out. 230 config.maintmode_enabled_by = u'any_user' 231 self.assertRaises( 232 Unauthorized, self.browser.open, 'http://localhost/app/customers') 233 self.browser.open('http://localhost/app/login') 234 self.assertMatches( 235 '...The portal is in maintenance mode...', 236 self.browser.contents) 237 # Officers really can't login if maintenance mode is enabled. 238 self.browser.getControl(name="form.login").value = 'officer' 239 self.browser.getControl(name="form.password").value = 'secret' 240 self.browser.getControl("Login").click() 241 # A second warning is raised. 242 self.assertMatches( 243 '...The portal is in maintenance mode. You can\'t login!...', 244 self.browser.contents) 245 # Offficer can login if s/he is the blocker. 246 config.maintmode_enabled_by = u'officer' 247 self.browser.getControl(name="form.login").value = 'officer' 248 self.browser.getControl(name="form.password").value = 'secret' 249 self.browser.getControl("Login").click() 250 self.assertTrue('You logged in' in self.browser.contents) 251 self.assertTrue('Logout' in self.browser.contents) 252 return 253 217 254 def test_sources_overview(self): 218 255 self.browser.open('http://localhost/app/sources')
Note: See TracChangeset for help on using the changeset viewer.