Changeset 10396
- Timestamp:
- 4 Jul 2013, 10:45:39 (11 years ago)
- Location:
- main/waeup.cas/trunk/waeup/cas
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.cas/trunk/waeup/cas/authenticators.py
r10394 r10396 97 97 98 98 def check_credentials(self, username='', password=''): 99 """If username is ``'bird'`` and password ``'bebop'`` return 100 ``True``, else ``False``. 99 """If username is ``'bird'`` and password ``'bebop'`` check 100 will succeed. 101 102 Returns a tuple ``(<STATUS>, <REASON>)`` with ``<STATUS>`` 103 being a boolean and ``<REASON>`` being a string giving the 104 reason why login failed (if so) or an empty string. 101 105 """ 102 return username == 'bird' and password == 'bebop' 106 reason = '' 107 result = username == 'bird' and password == 'bebop' 108 if not result: 109 reason = 'Invalid username or password.' 110 return result, reason -
main/waeup.cas/trunk/waeup/cas/tests/test_authenticators.py
r10394 r10396 51 51 auth = DummyAuthenticator() 52 52 result1 = auth.check_credentials('bird', 'bebop') 53 assert result1 is True53 assert result1 == (True, '') 54 54 result2 = auth.check_credentials('foo', 'bar') 55 assert result2 is False55 assert result2 == (False, 'Invalid username or password.')
Note: See TracChangeset for help on using the changeset viewer.