mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
[1.2.X] Fixed #14919 - test isolation issue with model_inheritance.ModelInheritanceTests.test_multiple_table and views.DefaultsTests.test_csrf_token_in_404
test_csrf_token_in_404 was assuming DEBUG = False, and test_multiple_table was leaving DEBUG = True. Both issues have been fixed. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14930 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -266,12 +266,16 @@ class ModelInheritanceTests(TestCase):
|
||||
# select_related works with fields from the parent object as if they
|
||||
# were a normal part of the model.
|
||||
old_DEBUG = settings.DEBUG
|
||||
starting_queries = len(connection.queries)
|
||||
settings.DEBUG = True
|
||||
try:
|
||||
settings.DEBUG = True
|
||||
starting_queries = len(connection.queries)
|
||||
ItalianRestaurant.objects.all()[0].chef
|
||||
self.assertEqual(len(connection.queries) - starting_queries, 2)
|
||||
|
||||
starting_queries = len(connection.queries)
|
||||
ItalianRestaurant.objects.select_related("chef")[0].chef
|
||||
self.assertEqual(len(connection.queries) - starting_queries, 1)
|
||||
finally:
|
||||
settings.DEBUG = old_DEBUG
|
||||
|
||||
ItalianRestaurant.objects.all()[0].chef
|
||||
self.assertEqual(len(connection.queries) - starting_queries, 2)
|
||||
|
||||
starting_queries = len(connection.queries)
|
||||
ItalianRestaurant.objects.select_related("chef")[0].chef
|
||||
self.assertEqual(len(connection.queries) - starting_queries, 1)
|
||||
|
||||
Reference in New Issue
Block a user