Ignore:
Timestamp:
19 Nov 2011, 13:08:05 (13 years ago)
Author:
uli
Message:

Add regression tests to ensure that password checking also works when
a student password is None or empty string.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_authentication.py

    r7137 r7138  
    138138        return
    139139
     140    def test_check_unset_password(self):
     141        # empty and unset passwords do not match anything
     142        self.fake_stud.password = None
     143        result1 = self.account.checkPassword('')
     144        self.fake_stud.password = ''
     145        result2 = self.account.checkPassword('')
     146        self.assertEqual(result1, False)
     147        self.assertEqual(result2, False)
     148        return
     149
     150    def test_check_password_no_string(self):
     151        # if passed in password is not a string, we gain no access
     152        self.fake_stud.password = 'secret'
     153        result1 = self.account.checkPassword(None)
     154        result2 = self.account.checkPassword(object())
     155        self.assertEqual(result1, False)
     156        self.assertEqual(result2, False)
     157        return
     158
    140159    def test_role_set(self):
    141160        # make sure we can set roles for principals denoted by account
Note: See TracChangeset for help on using the changeset viewer.