[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:
parent
b930733a67
commit
d255004289
|
@ -56,7 +56,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||
def test_loading_and_dumping(self):
|
||||
Site.objects.all().delete()
|
||||
# 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(), [
|
||||
'<Article: Time to reform copyright>',
|
||||
'<Article: Poker has no place on ESPN>',
|
||||
|
@ -87,7 +87,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||
self._dumpdata_assert(['fixtures.Category', 'sites'], '[{"pk": 1, "model": "fixtures.category", "fields": {"description": "Latest news stories", "title": "News Stories"}}, {"pk": 1, "model": "sites.site", "fields": {"domain": "example.com", "name": "example.com"}}]')
|
||||
|
||||
# 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(), [
|
||||
'<Article: Django conquers world!>',
|
||||
'<Article: Copyright is fine the way it is>',
|
||||
|
@ -95,7 +95,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||
])
|
||||
|
||||
# Load fixture 3, XML format.
|
||||
management.call_command('loaddata', 'fixture3.xml', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture3.xml', verbosity=0)
|
||||
self.assertQuerysetEqual(Article.objects.all(), [
|
||||
'<Article: XML identified as leading cause of cancer>',
|
||||
'<Article: Django conquers world!>',
|
||||
|
@ -104,14 +104,14 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||
])
|
||||
|
||||
# Load fixture 6, JSON file with dynamic ContentType fields. Testing ManyToOne.
|
||||
management.call_command('loaddata', 'fixture6.json', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture6.json', verbosity=0)
|
||||
self.assertQuerysetEqual(Tag.objects.all(), [
|
||||
'<Tag: <Article: Copyright is fine the way it is> tagged "copyright">',
|
||||
'<Tag: <Article: Copyright is fine the way it is> tagged "law">',
|
||||
], ordered=False)
|
||||
|
||||
# Load fixture 7, XML file with dynamic ContentType fields. Testing ManyToOne.
|
||||
management.call_command('loaddata', 'fixture7.xml', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture7.xml', verbosity=0)
|
||||
self.assertQuerysetEqual(Tag.objects.all(), [
|
||||
'<Tag: <Article: Copyright is fine the way it is> tagged "copyright">',
|
||||
'<Tag: <Article: Copyright is fine the way it is> tagged "legal">',
|
||||
|
@ -120,7 +120,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||
], ordered=False)
|
||||
|
||||
# Load fixture 8, JSON file with dynamic Permission fields. Testing ManyToMany.
|
||||
management.call_command('loaddata', 'fixture8.json', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture8.json', verbosity=0)
|
||||
self.assertQuerysetEqual(Visa.objects.all(), [
|
||||
'<Visa: Django Reinhardt Can add user, Can change user, Can delete user>',
|
||||
'<Visa: Stephane Grappelli Can add user>',
|
||||
|
@ -128,7 +128,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||
], ordered=False)
|
||||
|
||||
# Load fixture 9, XML file with dynamic Permission fields. Testing ManyToMany.
|
||||
management.call_command('loaddata', 'fixture9.xml', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture9.xml', verbosity=0)
|
||||
self.assertQuerysetEqual(Visa.objects.all(), [
|
||||
'<Visa: Django Reinhardt Can add user, Can change user, Can delete user>',
|
||||
'<Visa: Stephane Grappelli Can add user, Can delete user>',
|
||||
|
@ -143,15 +143,13 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||
# Loading a fixture that doesn't exist emits a warning
|
||||
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.")
|
||||
|
||||
# An attempt to load a nonexistent 'initial_data' fixture isn't an error
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
management.call_command('loaddata', 'initial_data.json', verbosity=0,
|
||||
commit=False)
|
||||
management.call_command('loaddata', 'initial_data.json', verbosity=0)
|
||||
self.assertEqual(len(w), 0)
|
||||
|
||||
# object list is unaffected
|
||||
|
@ -178,7 +176,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||
def test_dumpdata_with_excludes(self):
|
||||
# Load fixture1 which has a site, two articles, and a category
|
||||
Site.objects.all().delete()
|
||||
management.call_command('loaddata', 'fixture1.json', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture1.json', verbosity=0)
|
||||
|
||||
# Excluding fixtures app should only leave sites
|
||||
self._dumpdata_assert(
|
||||
|
@ -226,8 +224,8 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||
self._dumpdata_assert(['fixtures.Spy'], '[{"pk": %d, "model": "fixtures.spy", "fields": {"cover_blown": true}}, {"pk": %d, "model": "fixtures.spy", "fields": {"cover_blown": false}}]' % (spy2.pk, spy1.pk), use_base_manager=True)
|
||||
|
||||
def test_dumpdata_with_pks(self):
|
||||
management.call_command('loaddata', 'fixture1.json', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture2.json', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture1.json', verbosity=0)
|
||||
management.call_command('loaddata', 'fixture2.json', verbosity=0)
|
||||
self._dumpdata_assert(
|
||||
['fixtures.Article'],
|
||||
'[{"pk": 2, "model": "fixtures.article", "fields": {"headline": "Poker has no place on ESPN", "pub_date": "2006-06-16T12:00:00"}}, {"pk": 3, "model": "fixtures.article", "fields": {"headline": "Copyright is fine the way it is", "pub_date": "2006-06-16T14:00:00"}}]',
|
||||
|
@ -266,21 +264,21 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||
|
||||
def test_compress_format_loading(self):
|
||||
# Load fixture 4 (compressed), using format specification
|
||||
management.call_command('loaddata', 'fixture4.json', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture4.json', verbosity=0)
|
||||
self.assertQuerysetEqual(Article.objects.all(), [
|
||||
'<Article: Django pets kitten>',
|
||||
])
|
||||
|
||||
def test_compressed_specified_loading(self):
|
||||
# Load fixture 5 (compressed), using format *and* compression specification
|
||||
management.call_command('loaddata', 'fixture5.json.zip', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture5.json.zip', verbosity=0)
|
||||
self.assertQuerysetEqual(Article.objects.all(), [
|
||||
'<Article: WoW subscribers now outnumber readers>',
|
||||
])
|
||||
|
||||
def test_compressed_loading(self):
|
||||
# Load fixture 5 (compressed), only compression specification
|
||||
management.call_command('loaddata', 'fixture5.zip', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture5.zip', verbosity=0)
|
||||
self.assertQuerysetEqual(Article.objects.all(), [
|
||||
'<Article: WoW subscribers now outnumber readers>',
|
||||
])
|
||||
|
@ -288,13 +286,13 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||
def test_ambiguous_compressed_fixture(self):
|
||||
# The name "fixture5" is ambigous, so loading it will raise an error
|
||||
with self.assertRaises(management.CommandError) as cm:
|
||||
management.call_command('loaddata', 'fixture5', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture5', verbosity=0)
|
||||
self.assertIn("Multiple fixtures named 'fixture5'", cm.exception.args[0])
|
||||
|
||||
def test_db_loading(self):
|
||||
# Load db fixtures 1 and 2. These will load using the 'default' database identifier implicitly
|
||||
management.call_command('loaddata', 'db_fixture_1', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'db_fixture_2', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'db_fixture_1', verbosity=0)
|
||||
management.call_command('loaddata', 'db_fixture_2', verbosity=0)
|
||||
self.assertQuerysetEqual(Article.objects.all(), [
|
||||
'<Article: Who needs more than one database?>',
|
||||
'<Article: Who needs to use compressed data?>',
|
||||
|
@ -312,13 +310,13 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||
if connection.vendor == 'mysql':
|
||||
connection.cursor().execute("SET sql_mode = 'TRADITIONAL'")
|
||||
with self.assertRaises(IntegrityError) as cm:
|
||||
management.call_command('loaddata', 'invalid.json', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'invalid.json', verbosity=0)
|
||||
self.assertIn("Could not load fixtures.Article(pk=1):", cm.exception.args[0])
|
||||
|
||||
def test_loading_using(self):
|
||||
# Load db fixtures 1 and 2. These will load using the 'default' database identifier explicitly
|
||||
management.call_command('loaddata', 'db_fixture_1', verbosity=0, using='default', commit=False)
|
||||
management.call_command('loaddata', 'db_fixture_2', verbosity=0, using='default', commit=False)
|
||||
management.call_command('loaddata', 'db_fixture_1', verbosity=0, using='default')
|
||||
management.call_command('loaddata', 'db_fixture_2', verbosity=0, using='default')
|
||||
self.assertQuerysetEqual(Article.objects.all(), [
|
||||
'<Article: Who needs more than one database?>',
|
||||
'<Article: Who needs to use compressed data?>',
|
||||
|
@ -327,18 +325,18 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||
def test_unmatched_identifier_loading(self):
|
||||
# Try to load db fixture 3. This won't load because the database identifier doesn't match
|
||||
with warnings.catch_warnings(record=True):
|
||||
management.call_command('loaddata', 'db_fixture_3', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'db_fixture_3', verbosity=0)
|
||||
|
||||
with warnings.catch_warnings(record=True):
|
||||
management.call_command('loaddata', 'db_fixture_3', verbosity=0, using='default', commit=False)
|
||||
management.call_command('loaddata', 'db_fixture_3', verbosity=0, using='default')
|
||||
self.assertQuerysetEqual(Article.objects.all(), [])
|
||||
|
||||
def test_output_formats(self):
|
||||
# Load back in fixture 1, we need the articles from it
|
||||
management.call_command('loaddata', 'fixture1', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture1', verbosity=0)
|
||||
|
||||
# Try to load fixture 6 using format discovery
|
||||
management.call_command('loaddata', 'fixture6', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture6', verbosity=0)
|
||||
self.assertQuerysetEqual(Tag.objects.all(), [
|
||||
'<Tag: <Article: Time to reform copyright> tagged "copyright">',
|
||||
'<Tag: <Article: Time to reform copyright> tagged "law">'
|
||||
|
@ -364,7 +362,7 @@ class FixtureTransactionTests(DumpDataAssertMixin, TransactionTestCase):
|
|||
@skipUnlessDBFeature('supports_forward_references')
|
||||
def test_format_discovery(self):
|
||||
# Load fixture 1 again, using format discovery
|
||||
management.call_command('loaddata', 'fixture1', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture1', verbosity=0)
|
||||
self.assertQuerysetEqual(Article.objects.all(), [
|
||||
'<Article: Time to reform copyright>',
|
||||
'<Article: Poker has no place on ESPN>',
|
||||
|
@ -386,7 +384,7 @@ class FixtureTransactionTests(DumpDataAssertMixin, TransactionTestCase):
|
|||
self._dumpdata_assert(['fixtures'], '[{"pk": 1, "model": "fixtures.category", "fields": {"description": "Latest news stories", "title": "News Stories"}}, {"pk": 2, "model": "fixtures.article", "fields": {"headline": "Poker has no place on ESPN", "pub_date": "2006-06-16T12:00:00"}}, {"pk": 3, "model": "fixtures.article", "fields": {"headline": "Time to reform copyright", "pub_date": "2006-06-16T13:00:00"}}, {"pk": 10, "model": "fixtures.book", "fields": {"name": "Achieving self-awareness of Python programs", "authors": []}}]')
|
||||
|
||||
# Load fixture 4 (compressed), using format discovery
|
||||
management.call_command('loaddata', 'fixture4', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'fixture4', verbosity=0)
|
||||
self.assertQuerysetEqual(Article.objects.all(), [
|
||||
'<Article: Django pets kitten>',
|
||||
'<Article: Time to reform copyright>',
|
||||
|
|
|
@ -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.")
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
'sequence',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
|
||||
# Create a new animal. Without a sequence reset, this new object
|
||||
|
@ -84,7 +83,6 @@ class TestFixtures(TestCase):
|
|||
'sequence_extra',
|
||||
ignore=True,
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
self.assertEqual(Animal.specimens.all()[0].name, 'Lion')
|
||||
|
||||
|
@ -98,7 +96,6 @@ class TestFixtures(TestCase):
|
|||
'sequence_extra_xml',
|
||||
ignore=True,
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
self.assertEqual(Animal.specimens.all()[0].name, 'Wolf')
|
||||
|
||||
|
@ -113,7 +110,6 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
'pretty.xml',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
self.assertEqual(Stuff.objects.all()[0].name, None)
|
||||
self.assertEqual(Stuff.objects.all()[0].owner, None)
|
||||
|
@ -129,7 +125,6 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
'pretty.xml',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
self.assertEqual(Stuff.objects.all()[0].name, '')
|
||||
self.assertEqual(Stuff.objects.all()[0].owner, None)
|
||||
|
@ -152,7 +147,6 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
load_absolute_path,
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
self.assertEqual(Absolute.load_count, 1)
|
||||
|
||||
|
@ -168,7 +162,6 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
'bad_fixture1.unkn',
|
||||
verbosity=0,
|
||||
commit=False,
|
||||
)
|
||||
|
||||
@override_settings(SERIALIZATION_MODULES={'unkn': 'unexistent.path'})
|
||||
|
@ -182,7 +175,6 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
'bad_fixture1.unkn',
|
||||
verbosity=0,
|
||||
commit=False,
|
||||
)
|
||||
|
||||
def test_invalid_data(self):
|
||||
|
@ -197,7 +189,6 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
'bad_fixture2.xml',
|
||||
verbosity=0,
|
||||
commit=False,
|
||||
)
|
||||
|
||||
def test_invalid_data_no_ext(self):
|
||||
|
@ -212,7 +203,6 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
'bad_fixture2',
|
||||
verbosity=0,
|
||||
commit=False,
|
||||
)
|
||||
|
||||
def test_empty(self):
|
||||
|
@ -226,7 +216,6 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
'empty',
|
||||
verbosity=0,
|
||||
commit=False,
|
||||
)
|
||||
|
||||
def test_error_message(self):
|
||||
|
@ -240,7 +229,6 @@ class TestFixtures(TestCase):
|
|||
'bad_fixture2',
|
||||
'animal',
|
||||
verbosity=0,
|
||||
commit=False,
|
||||
)
|
||||
|
||||
def test_pg_sequence_resetting_checks(self):
|
||||
|
@ -253,7 +241,6 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
'model-inheritance.json',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
self.assertEqual(Parent.objects.all()[0].id, 1)
|
||||
self.assertEqual(Child.objects.all()[0].id, 1)
|
||||
|
@ -270,7 +257,6 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
'big-fixture.json',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
articles = Article.objects.exclude(id=9)
|
||||
self.assertEqual(
|
||||
|
@ -297,7 +283,6 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
'animal.xml',
|
||||
verbosity=0,
|
||||
commit=False,
|
||||
)
|
||||
self.assertEqual(
|
||||
self.pre_save_checks,
|
||||
|
@ -319,13 +304,11 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
'animal.xml',
|
||||
verbosity=0,
|
||||
commit=False,
|
||||
)
|
||||
management.call_command(
|
||||
'loaddata',
|
||||
'sequence.json',
|
||||
verbosity=0,
|
||||
commit=False,
|
||||
)
|
||||
animal = Animal(
|
||||
name='Platypus',
|
||||
|
@ -390,7 +373,6 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
'forward_ref.json',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
self.assertEqual(Book.objects.all()[0].id, 1)
|
||||
self.assertEqual(Person.objects.all()[0].id, 4)
|
||||
|
@ -405,7 +387,6 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
'forward_ref_bad_data.json',
|
||||
verbosity=0,
|
||||
commit=False,
|
||||
)
|
||||
|
||||
_cur_dir = os.path.dirname(os.path.abspath(upath(__file__)))
|
||||
|
@ -422,7 +403,6 @@ class TestFixtures(TestCase):
|
|||
'forward_ref_1.json',
|
||||
'forward_ref_2.json',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
self.assertEqual(Book.objects.all()[0].id, 1)
|
||||
self.assertEqual(Person.objects.all()[0].id, 4)
|
||||
|
@ -437,7 +417,6 @@ class TestFixtures(TestCase):
|
|||
management.call_command(
|
||||
'loaddata',
|
||||
verbosity=0,
|
||||
commit=False,
|
||||
)
|
||||
|
||||
def test_loaddata_not_existant_fixture_file(self):
|
||||
|
@ -447,7 +426,6 @@ class TestFixtures(TestCase):
|
|||
'loaddata',
|
||||
'this_fixture_doesnt_exist',
|
||||
verbosity=2,
|
||||
commit=False,
|
||||
stdout=stdout_output,
|
||||
)
|
||||
self.assertTrue("No fixture 'this_fixture_doesnt_exist' in" in
|
||||
|
@ -465,13 +443,11 @@ class NaturalKeyFixtureTests(TestCase):
|
|||
'loaddata',
|
||||
'model-inheritance.json',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
management.call_command(
|
||||
'loaddata',
|
||||
'nk-inheritance.json',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
self.assertEqual(
|
||||
NKChild.objects.get(pk=1).data,
|
||||
|
@ -492,19 +468,16 @@ class NaturalKeyFixtureTests(TestCase):
|
|||
'loaddata',
|
||||
'model-inheritance.json',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
management.call_command(
|
||||
'loaddata',
|
||||
'nk-inheritance.json',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
management.call_command(
|
||||
'loaddata',
|
||||
'nk-inheritance2.xml',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
self.assertEqual(
|
||||
NKChild.objects.get(pk=2).data,
|
||||
|
@ -524,7 +497,6 @@ class NaturalKeyFixtureTests(TestCase):
|
|||
'loaddata',
|
||||
'forward_ref_lookup.json',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
|
||||
stdout = StringIO()
|
||||
|
@ -662,19 +634,16 @@ class NaturalKeyFixtureTests(TestCase):
|
|||
'loaddata',
|
||||
'non_natural_1.json',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
management.call_command(
|
||||
'loaddata',
|
||||
'forward_ref_lookup.json',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
management.call_command(
|
||||
'loaddata',
|
||||
'non_natural_2.xml',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
books = Book.objects.all()
|
||||
self.assertEqual(
|
||||
|
@ -696,7 +665,6 @@ class TestTicket11101(TransactionTestCase):
|
|||
'loaddata',
|
||||
'thingy.json',
|
||||
verbosity=0,
|
||||
commit=False
|
||||
)
|
||||
self.assertEqual(Thingy.objects.count(), 1)
|
||||
transaction.rollback()
|
||||
|
|
|
@ -358,7 +358,7 @@ class ProxyModelTests(TestCase):
|
|||
)
|
||||
|
||||
def test_proxy_load_from_fixture(self):
|
||||
management.call_command('loaddata', 'mypeople.json', verbosity=0, commit=False)
|
||||
management.call_command('loaddata', 'mypeople.json', verbosity=0)
|
||||
p = MyPerson.objects.get(pk=100)
|
||||
self.assertEqual(p.name, 'Elvis Presley')
|
||||
|
||||
|
|
Loading…
Reference in New Issue