Ticket #20387: 20387.patch

File 20387.patch, 1.7 KB (added by Aymeric Augustin, 12 years ago)
  • tests/admin_views/tests.py

    diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
    index e0000ff..39c0eb1 100644
    a b from django.contrib.auth import REDIRECT_FIELD_NAME  
    2626from django.contrib.auth.models import Group, User, Permission, UNUSABLE_PASSWORD
    2727from django.contrib.contenttypes.models import ContentType
    2828from django.core.urlresolvers import reverse
     29from django.db import connection
    2930from django.forms.util import ErrorList
    3031from django.template.response import TemplateResponse
    3132from django.test import TestCase
    class UserAdminTest(TestCase):  
    36053606
    36063607        # Don't depend on a warm cache, see #17377.
    36073608        ContentType.objects.clear_cache()
    3608         with self.assertNumQueries(10):
     3609
     3610        expected_queries = 10
     3611        # Oracle doesn't implement "RELEASE SAVPOINT", see #20387.
     3612        if connection.vendor == 'oracle':
     3613            expected_queries -= 1
     3614
     3615        with self.assertNumQueries(9):
    36093616            response = self.client.get('/test_admin/admin/auth/user/%s/' % u.pk)
    36103617            self.assertEqual(response.status_code, 200)
    36113618
    class GroupAdminTest(TestCase):  
    36433650    def test_group_permission_performance(self):
    36443651        g = Group.objects.create(name="test_group")
    36453652
    3646         with self.assertNumQueries(8):  # instead of 259!
     3653        expected_queries = 8
     3654        # Oracle doesn't implement "RELEASE SAVPOINT", see #20387.
     3655        if connection.vendor == 'oracle':
     3656            expected_queries -= 1
     3657
     3658        with self.assertNumQueries(expected_queries):
    36473659            response = self.client.get('/test_admin/admin/auth/group/%s/' % g.pk)
    36483660            self.assertEqual(response.status_code, 200)
    36493661
Back to Top