~grupoesoc/cubicerp-addons/7.0

« back to all changes in this revision

Viewing changes to report_geraldo/lib/geraldo/site/newsite/site-geraldo/django/contrib/auth/tests/basic.py

  • Committer: Cubic ERP
  • Date: 2014-01-07 15:38:09 UTC
  • Revision ID: info@cubicerp.com-20140107153809-4jmif3zoi8rcveve
[ADD] cubicReport

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
BASIC_TESTS = """
 
3
>>> from django.contrib.auth.models import User, AnonymousUser
 
4
>>> u = User.objects.create_user('testuser', 'test@example.com', 'testpw')
 
5
>>> u.has_usable_password()
 
6
True
 
7
>>> u.check_password('bad')
 
8
False
 
9
>>> u.check_password('testpw')
 
10
True
 
11
>>> u.set_unusable_password()
 
12
>>> u.save()
 
13
>>> u.check_password('testpw')
 
14
False
 
15
>>> u.has_usable_password()
 
16
False
 
17
>>> u2 = User.objects.create_user('testuser2', 'test2@example.com')
 
18
>>> u2.has_usable_password()
 
19
False
 
20
 
 
21
>>> u.is_authenticated()
 
22
True
 
23
>>> u.is_staff
 
24
False
 
25
>>> u.is_active
 
26
True
 
27
 
 
28
>>> a = AnonymousUser()
 
29
>>> a.is_authenticated()
 
30
False
 
31
>>> a.is_staff
 
32
False
 
33
>>> a.is_active
 
34
False
 
35
>>> a.groups.all()
 
36
[]
 
37
>>> a.user_permissions.all()
 
38
[]
 
39
 
 
40
#
 
41
# Tests for createsuperuser management command.
 
42
# It's nearly impossible to test the interactive mode -- a command test helper
 
43
# would be needed (and *awesome*) -- so just test the non-interactive mode.
 
44
# This covers most of the important validation, but not all.
 
45
#
 
46
>>> from django.core.management import call_command
 
47
 
 
48
>>> call_command("createsuperuser", noinput=True, username="joe", email="joe@somewhere.org")
 
49
Superuser created successfully.
 
50
 
 
51
>>> u = User.objects.get(username="joe")
 
52
>>> u.email
 
53
u'joe@somewhere.org'
 
54
>>> u.password
 
55
u'!'
 
56
"""