Reverted parts of r14891 and r16400 due to inherent brokenness of tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16482 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
6fe2a8bb3f
commit
f4aa39837a
|
@ -1,307 +0,0 @@
|
|||
[
|
||||
{
|
||||
"pk": 4,
|
||||
"model": "contenttypes.contenttype",
|
||||
"fields": {
|
||||
"model": "contenttype",
|
||||
"name": "content type",
|
||||
"app_label": "contenttypes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 2,
|
||||
"model": "contenttypes.contenttype",
|
||||
"fields": {
|
||||
"model": "group",
|
||||
"name": "group",
|
||||
"app_label": "auth"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 7,
|
||||
"model": "contenttypes.contenttype",
|
||||
"fields": {
|
||||
"model": "logentry",
|
||||
"name": "log entry",
|
||||
"app_label": "admin"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "contenttypes.contenttype",
|
||||
"fields": {
|
||||
"model": "permission",
|
||||
"name": "permission",
|
||||
"app_label": "auth"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 5,
|
||||
"model": "contenttypes.contenttype",
|
||||
"fields": {
|
||||
"model": "session",
|
||||
"name": "session",
|
||||
"app_label": "sessions"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 6,
|
||||
"model": "contenttypes.contenttype",
|
||||
"fields": {
|
||||
"model": "site",
|
||||
"name": "site",
|
||||
"app_label": "sites"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 3,
|
||||
"model": "contenttypes.contenttype",
|
||||
"fields": {
|
||||
"model": "user",
|
||||
"name": "user",
|
||||
"app_label": "auth"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "sites.site",
|
||||
"fields": {
|
||||
"domain": "example.com",
|
||||
"name": "example.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 22,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "add_logentry",
|
||||
"name": "Can add log entry",
|
||||
"content_type": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 23,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "change_logentry",
|
||||
"name": "Can change log entry",
|
||||
"content_type": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 24,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "delete_logentry",
|
||||
"name": "Can delete log entry",
|
||||
"content_type": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 4,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "add_group",
|
||||
"name": "Can add group",
|
||||
"content_type": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 5,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "change_group",
|
||||
"name": "Can change group",
|
||||
"content_type": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 6,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "delete_group",
|
||||
"name": "Can delete group",
|
||||
"content_type": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 10,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "add_message",
|
||||
"name": "Can add message",
|
||||
"content_type": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 11,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "change_message",
|
||||
"name": "Can change message",
|
||||
"content_type": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 12,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "delete_message",
|
||||
"name": "Can delete message",
|
||||
"content_type": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "add_permission",
|
||||
"name": "Can add permission",
|
||||
"content_type": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 2,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "change_permission",
|
||||
"name": "Can change permission",
|
||||
"content_type": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 3,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "delete_permission",
|
||||
"name": "Can delete permission",
|
||||
"content_type": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 7,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "add_user",
|
||||
"name": "Can add user",
|
||||
"content_type": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 8,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "change_user",
|
||||
"name": "Can change user",
|
||||
"content_type": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 9,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "delete_user",
|
||||
"name": "Can delete user",
|
||||
"content_type": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 13,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "add_contenttype",
|
||||
"name": "Can add content type",
|
||||
"content_type": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 14,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "change_contenttype",
|
||||
"name": "Can change content type",
|
||||
"content_type": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 15,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "delete_contenttype",
|
||||
"name": "Can delete content type",
|
||||
"content_type": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 16,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "add_session",
|
||||
"name": "Can add session",
|
||||
"content_type": 6
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 17,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "change_session",
|
||||
"name": "Can change session",
|
||||
"content_type": 6
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 18,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "delete_session",
|
||||
"name": "Can delete session",
|
||||
"content_type": 6
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 19,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "add_site",
|
||||
"name": "Can add site",
|
||||
"content_type": 7
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 20,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "change_site",
|
||||
"name": "Can change site",
|
||||
"content_type": 7
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 21,
|
||||
"model": "auth.permission",
|
||||
"fields": {
|
||||
"codename": "delete_site",
|
||||
"name": "Can delete site",
|
||||
"content_type": 7
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "auth.user",
|
||||
"fields": {
|
||||
"username": "admin",
|
||||
"first_name": "",
|
||||
"last_name": "",
|
||||
"is_active": true,
|
||||
"is_superuser": true,
|
||||
"is_staff": true,
|
||||
"last_login": "2010-11-19 06:26:59",
|
||||
"groups": [],
|
||||
"user_permissions": [],
|
||||
"password": "sha1$e72a2$950781326ec9546d172a20681ba3c762f23104b0",
|
||||
"email": "admin@example.com",
|
||||
"date_joined": "2010-11-19 06:26:59"
|
||||
}
|
||||
}
|
||||
]
|
|
@ -1,38 +0,0 @@
|
|||
try:
|
||||
from cStringIO import StringIO
|
||||
except ImportError:
|
||||
from StringIO import StringIO
|
||||
|
||||
from django.contrib.auth.management import create_permissions
|
||||
from django.contrib.auth import models as auth_models
|
||||
from django.contrib.contenttypes import models as contenttypes_models
|
||||
from django.core.management import call_command
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
class TestAuthPermissions(TestCase):
|
||||
def tearDown(self):
|
||||
# These tests mess with content types, but content type lookups
|
||||
# are cached, so we need to make sure the effects of this test
|
||||
# are cleaned up.
|
||||
contenttypes_models.ContentType.objects.clear_cache()
|
||||
|
||||
def test_permission_register_order(self):
|
||||
"""Test that the order of registered permissions doesn't break"""
|
||||
# Changeset 14413 introduced a regression in the ordering of
|
||||
# newly created permissions for objects. When loading a fixture
|
||||
# after the initial creation (such as during unit tests), the
|
||||
# expected IDs for the permissions may not match up, leading to
|
||||
# SQL errors. This is ticket 14731
|
||||
|
||||
# Start with a clean slate and build the permissions as we
|
||||
# expect to see them in the fixtures.
|
||||
auth_models.Permission.objects.all().delete()
|
||||
contenttypes_models.ContentType.objects.all().delete()
|
||||
create_permissions(auth_models, [], verbosity=0)
|
||||
create_permissions(contenttypes_models, [], verbosity=0)
|
||||
|
||||
stdout = StringIO()
|
||||
call_command('loaddata', 'permissionstestdata.json',
|
||||
verbosity=1, commit=False, stdout=stdout)
|
||||
self.assertNotEqual(stdout.getvalue(), 'No fixtures found.\n')
|
Loading…
Reference in New Issue