Changeset 13394 for main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Timestamp:
- 6 Nov 2015, 05:43:37 (9 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/authentication.py
r9335 r13394 48 48 def checkPassword(self, password): 49 49 """Check whether the given `password` matches the one stored by 50 students. 51 52 We additionally check if student account has been suspended. 50 students. We additionally check if applicant account has been suspended 51 or if the portal is blocked. 53 52 """ 53 try: 54 blocker = grok.getSite()['configuration'].maintmode_enabled_by 55 if blocker: 56 return False 57 except TypeError: # in unit tests 58 pass 54 59 if not isinstance(password, basestring): 55 60 return False -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
r13365 r13394 1199 1199 if self.context.expired: 1200 1200 self.flash(_('Outside application period.'), type='warning') 1201 self.redirect(self.url(self.context)) 1202 return 1203 blocker = grok.getSite()['configuration'].maintmode_enabled_by 1204 if blocker: 1205 self.flash(_('The portal is in maintenance mode ' 1206 'and registration temporarily disabled.'), 1207 type='warning') 1201 1208 self.redirect(self.url(self.context)) 1202 1209 return -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
r13365 r13394 609 609 self.assertTrue( 610 610 'You logged in.' in self.browser.contents) 611 612 def test_maintenance_mode(self): 613 config = grok.getSite()['configuration'] 614 self.login() 615 # Applicant logged in. 616 self.assertTrue('You logged in' in self.browser.contents) 617 self.assertTrue("Joan None" in self.browser.contents) 618 # If maintenance mode is enabled, applicant is immediately logged out. 619 config.maintmode_enabled_by = u'any_user' 620 self.assertRaises( 621 Unauthorized, self.browser.open, 'http://localhost/app/faculties') 622 self.browser.open('http://localhost/app/login') 623 self.assertTrue('The portal is in maintenance mode' in self.browser.contents) 624 # Applicant really can't login if maintenance mode is enabled. 625 self.login() 626 # A second warning is raised. 627 self.assertTrue( 628 'The portal is in maintenance mode. You can\'t login!' 629 in self.browser.contents) 630 return 611 631 612 632 def test_applicant_access(self): … … 1250 1270 1251 1271 def test_register_applicant_create(self): 1272 config = grok.getSite()['configuration'] 1273 config.maintmode_enabled_by = u'any_user' 1252 1274 self.assertEqual(len(self.app['applicants'][container_name_1]), 1) 1253 1275 # An applicant can register himself. 1254 1276 self.browser.open(self.container_path) 1255 1277 self.browser.getLink("Register for application").click() 1256 # Fill the edit form with suitable values 1278 self.assertTrue( 1279 'The portal is in maintenance mode' in self.browser.contents) 1280 config.maintmode_enabled_by = None 1281 self.browser.getLink("Register for application").click() 1282 # The edit form now opens and can be filled with suitable values 1257 1283 self.browser.getControl(name="form.firstname").value = 'Anna' 1258 1284 self.browser.getControl(name="form.lastname").value = 'Kurios'
Note: See TracChangeset for help on using the changeset viewer.