summaryrefslogtreecommitdiff
path: root/tests/regressiontests
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2009-10-24 00:23:47 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2009-10-24 00:23:47 +0000
commit9f70783b149105dfd37027504976f9526caeeae0 (patch)
treec586ca2a6379c4e8a4e49a5d9b6b4651055fdc3e /tests/regressiontests
parent0d1177ae99a493272b2ef6982e4adc7141f15f72 (diff)
Fixed a couple of test-ordering-dependant failures introduced in [11639] that caused test failures when running the whole test suite.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11645 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
-rw-r--r--tests/regressiontests/comment_tests/tests/moderation_view_tests.py9
-rw-r--r--tests/regressiontests/comment_tests/urls_admin.py9
2 files changed, 13 insertions, 5 deletions
diff --git a/tests/regressiontests/comment_tests/tests/moderation_view_tests.py b/tests/regressiontests/comment_tests/tests/moderation_view_tests.py
index 61e90bc220..c9b50e2983 100644
--- a/tests/regressiontests/comment_tests/tests/moderation_view_tests.py
+++ b/tests/regressiontests/comment_tests/tests/moderation_view_tests.py
@@ -168,9 +168,12 @@ class AdminActionsTests(CommentTestCase):
# Make "normaluser" a moderator
u = User.objects.get(username="normaluser")
u.is_staff = True
- u.user_permissions.add(Permission.objects.get(codename='add_comment'))
- u.user_permissions.add(Permission.objects.get(codename='change_comment'))
- u.user_permissions.add(Permission.objects.get(codename='delete_comment'))
+ perms = Permission.objects.filter(
+ content_type__app_label = 'comments',
+ codename__endswith = 'comment'
+ )
+ for perm in perms:
+ u.user_permissions.add(perm)
u.save()
def testActionsNonModerator(self):
diff --git a/tests/regressiontests/comment_tests/urls_admin.py b/tests/regressiontests/comment_tests/urls_admin.py
index 9e43d34865..341285d7ef 100644
--- a/tests/regressiontests/comment_tests/urls_admin.py
+++ b/tests/regressiontests/comment_tests/urls_admin.py
@@ -1,8 +1,13 @@
from django.conf.urls.defaults import *
from django.contrib import admin
+from django.contrib.comments.admin import CommentsAdmin
+from django.contrib.comments.models import Comment
-admin.autodiscover()
+# Make a new AdminSite to avoid picking up the deliberately broken admin
+# modules in other tests.
+admin_site = admin.AdminSite()
+admin_site.register(Comment, CommentsAdmin)
urlpatterns = patterns('',
- (r'^admin/', include(admin.site.urls)),
+ (r'^admin/', include(admin_site.urls)),
)