equal
deleted
inserted
replaced
|
1 """ |
|
2 >>> from models import User, AnonymousUser |
|
3 >>> u = User.objects.create_user('testuser', 'test@example.com', 'testpw') |
|
4 >>> u.has_usable_password() |
|
5 True |
|
6 >>> u.check_password('bad') |
|
7 False |
|
8 >>> u.check_password('testpw') |
|
9 True |
|
10 >>> u.set_unusable_password() |
|
11 >>> u.save() |
|
12 >>> u.check_password('testpw') |
|
13 False |
|
14 >>> u.has_usable_password() |
|
15 False |
|
16 >>> u2 = User.objects.create_user('testuser2', 'test2@example.com') |
|
17 >>> u2.has_usable_password() |
|
18 False |
|
19 |
|
20 >>> u.is_authenticated() |
|
21 True |
|
22 >>> u.is_staff |
|
23 False |
|
24 >>> u.is_active |
|
25 True |
|
26 |
|
27 >>> a = AnonymousUser() |
|
28 >>> a.is_authenticated() |
|
29 False |
|
30 >>> a.is_staff |
|
31 False |
|
32 >>> a.is_active |
|
33 False |
|
34 >>> a.groups.all() |
|
35 [] |
|
36 >>> a.user_permissions.all() |
|
37 [] |
|
38 """ |