Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed the auth_backend tests in a cosmteic fashion so that they pas…

…s under Python 2.3 as well.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6552 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit cb38521487832999ac2ec147ab5dc96a96bc25ab 1 parent a0fdd7c
Malcolm Tredinnick malcolmt authored
Showing with 18 additions and 12 deletions.
  1. +18 −12 tests/regressiontests/auth_backends/tests.py
30 tests/regressiontests/auth_backends/tests.py
View
@@ -1,4 +1,9 @@
-"""
+try:
+ set
+except NameError:
+ from sets import Set as set # Python 2.3 fallback
+
+__test__ = {'API_TESTS': """
>>> from django.contrib.auth.models import User, Group, Permission
>>> from django.contrib.contenttypes.models import ContentType
@@ -28,10 +33,10 @@
# reloading user to purge the _perm_cache
>>> user = User.objects.get(username="test")
->>> user.get_all_permissions()
-set([u'auth.test'])
->>> user.get_group_permissions()
-set([])
+>>> user.get_all_permissions() == set([u'auth.test'])
+True
+>>> user.get_group_permissions() == set([])
+True
>>> user.has_module_perms("Group")
False
>>> user.has_module_perms("auth")
@@ -43,8 +48,8 @@
>>> user.user_permissions.add(perm)
>>> user.save()
>>> user = User.objects.get(username="test")
->>> user.get_all_permissions()
-set([u'auth.test2', u'auth.test', u'auth.test3'])
+>>> user.get_all_permissions() == set([u'auth.test2', u'auth.test', u'auth.test3'])
+True
>>> user.has_perm('test')
False
>>> user.has_perm('auth.test')
@@ -57,10 +62,11 @@
>>> group.save()
>>> user.groups.add(group)
>>> user = User.objects.get(username="test")
->>> user.get_all_permissions()
-set([u'auth.test2', u'auth.test', u'auth.test3', u'auth.test_group'])
->>> user.get_group_permissions()
-set([u'auth.test_group'])
+>>> exp = set([u'auth.test2', u'auth.test', u'auth.test3', u'auth.test_group'])
+>>> user.get_all_permissions() == exp
+True
+>>> user.get_group_permissions() == set([u'auth.test_group'])
+True
>>> user.has_perms(['auth.test3', 'auth.test_group'])
True
-"""
+"""}
Please sign in to comment.
Something went wrong with that request. Please try again.