2007-07-29 02:30:40 +08:00
|
|
|
"""
|
2007-09-16 02:01:29 +08:00
|
|
|
>>> from models import User, AnonymousUser
|
2007-07-29 02:30:40 +08:00
|
|
|
>>> u = User.objects.create_user('testuser', 'test@example.com', 'testpw')
|
|
|
|
>>> u.has_usable_password()
|
|
|
|
True
|
|
|
|
>>> u.check_password('bad')
|
|
|
|
False
|
|
|
|
>>> u.check_password('testpw')
|
|
|
|
True
|
|
|
|
>>> u.set_unusable_password()
|
|
|
|
>>> u.save()
|
|
|
|
>>> u.check_password('testpw')
|
|
|
|
False
|
|
|
|
>>> u.has_usable_password()
|
|
|
|
False
|
|
|
|
>>> u2 = User.objects.create_user('testuser2', 'test2@example.com')
|
|
|
|
>>> u2.has_usable_password()
|
|
|
|
False
|
2007-09-16 02:01:29 +08:00
|
|
|
>>> a = AnonymousUser()
|
|
|
|
>>> a.is_staff
|
|
|
|
False
|
|
|
|
>>> a.groups.all()
|
|
|
|
[]
|
|
|
|
>>> a.user_permissions.all()
|
|
|
|
[]
|
2007-07-29 02:30:40 +08:00
|
|
|
"""
|