1
0
mirror of https://github.com/django/django.git synced 2025-10-27 15:46:10 +00:00

[1.6.x] Stopped calling loaddata with commit=False.

This was a stealth option only used by the tests, and it isn't useful
any more since `atomic` provides nested transactions.

Backport of 2c40681 from master.
This commit is contained in:
Aymeric Augustin
2013-06-30 14:17:33 +02:00
parent b930733a67
commit d255004289
4 changed files with 31 additions and 66 deletions

View File

@@ -60,7 +60,6 @@ class TestNoInitialDataLoading(TransactionTestCase):
'flush',
verbosity=0,
interactive=False,
commit=False,
load_initial_data=False
)
self.assertQuerysetEqual(Book.objects.all(), [])
@@ -83,7 +82,7 @@ class FixtureTestCase(TestCase):
def test_loaddata(self):
"Fixtures can load data into models defined in packages"
# Load fixture 1. Single JSON file, with two objects
management.call_command("loaddata", "fixture1.json", verbosity=0, commit=False)
management.call_command("loaddata", "fixture1.json", verbosity=0)
self.assertQuerysetEqual(
Article.objects.all(), [
"Time to reform copyright",
@@ -94,7 +93,7 @@ class FixtureTestCase(TestCase):
# Load fixture 2. JSON file imported by default. Overwrites some
# existing objects
management.call_command("loaddata", "fixture2.json", verbosity=0, commit=False)
management.call_command("loaddata", "fixture2.json", verbosity=0)
self.assertQuerysetEqual(
Article.objects.all(), [
"Django conquers world!",
@@ -107,7 +106,7 @@ class FixtureTestCase(TestCase):
# Load a fixture that doesn't exist
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
management.call_command("loaddata", "unknown.json", verbosity=0, commit=False)
management.call_command("loaddata", "unknown.json", verbosity=0)
self.assertEqual(len(w), 1)
self.assertTrue(w[0].message, "No fixture named 'unknown' found.")