1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

[1.2.X] Refs #14661 -- Clarified the handling of initial data injected via custom SQL.

This is BACKWARDS INCOMPATIBLE CHANGE for anyone relying on SQL-injected initial data in a test case.

Backport of r15239 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee
2011-01-18 16:55:00 +00:00
parent 86239cbb56
commit 0958f32209
7 changed files with 83 additions and 5 deletions

View File

@@ -5,4 +5,11 @@ from models import Simple
class InitialSQLTests(TestCase):
def test_initial_sql(self):
self.assertEqual(Simple.objects.count(), 7)
# The format of the included SQL file for this test suite is important.
# It must end with a trailing newline in order to test the fix for #2161.
# However, as pointed out by #14661, test data loaded by custom SQL
# can't be relied upon; as a result, the test framework flushes the
# data contents before every test. This test validates that this has
# occurred.
self.assertEqual(Simple.objects.count(), 0)