Changeset 13394 for main/waeup.kofa/trunk/src/waeup/kofa/students
- Timestamp:
- 6 Nov 2015, 05:43:37 (9 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/authentication.py
r12926 r13394 113 113 """Check whether the given `password` matches the one stored by 114 114 students or the temporary password set by officers. 115 116 We additionally check if student account has been suspended. 117 """ 115 We additionally check if student account has been suspended 116 or if the portal is blocked. 117 """ 118 try: 119 blocker = grok.getSite()['configuration'].maintmode_enabled_by 120 if blocker: 121 return False 122 except TypeError: # in unit tests 123 pass 118 124 if not isinstance(password, basestring): 119 125 return False -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r13349 r13394 1387 1387 filewidget.add_file(filecontents, 'text/plain', 'students.csv') 1388 1388 self.browser.getControl(name='SUBMIT').click() 1389 self.browser.getLink("Switch maintenance mode").click() 1389 1390 self.browser.getLink('Process data').click() 1390 1391 button = lookup_submit_value( … … 1413 1414 filewidget.add_file(filecontents, 'text/plain', 'studycourses.csv') 1414 1415 self.browser.getControl(name='SUBMIT').click() 1416 # Meanwhile maintenance mode is disabled again. 1417 self.browser.getLink("Switch maintenance mode").click() 1415 1418 self.browser.getLink('Process data').click() 1416 1419 button = lookup_submit_value( … … 2376 2379 '...You logged in...', self.browser.contents) 2377 2380 2381 def test_maintenance_mode(self): 2382 config = grok.getSite()['configuration'] 2383 self.browser.open(self.login_path) 2384 self.browser.getControl(name="form.login").value = self.student_id 2385 self.browser.getControl(name="form.password").value = 'spwd' 2386 self.browser.getControl("Login").click() 2387 # Student logged in. 2388 self.assertTrue('You logged in' in self.browser.contents) 2389 self.assertTrue("Anna Tester" in self.browser.contents) 2390 # If maintenance mode is enabled, student is immediately logged out. 2391 config.maintmode_enabled_by = u'any_user' 2392 self.assertRaises( 2393 Unauthorized, self.browser.open, 'http://localhost/app/faculties') 2394 self.browser.open('http://localhost/app/login') 2395 self.assertTrue('The portal is in maintenance mode' in self.browser.contents) 2396 # Student really can't login if maintenance mode is enabled. 2397 self.browser.open(self.login_path) 2398 self.browser.getControl(name="form.login").value = self.student_id 2399 self.browser.getControl(name="form.password").value = 'spwd' 2400 self.browser.getControl("Login").click() 2401 # A second warning is raised. 2402 self.assertTrue( 2403 'The portal is in maintenance mode. You can\'t login!' 2404 in self.browser.contents) 2405 return 2406 2378 2407 def test_student_clearance(self): 2379 2408 # Student cant login if their password is not set
Note: See TracChangeset for help on using the changeset viewer.