mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #21969: Fix behaviour of initial_data with migrated apps
This commit is contained in:
parent
250841017c
commit
d5df7a0515
5 changed files with 48 additions and 2 deletions
11
tests/fixtures/tests.py
vendored
11
tests/fixtures/tests.py
vendored
|
@ -329,6 +329,17 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
|||
management.call_command('loaddata', 'invalid.json', verbosity=0)
|
||||
self.assertIn("Could not load fixtures.Article(pk=1):", cm.exception.args[0])
|
||||
|
||||
def test_loaddata_app_option(self):
|
||||
"""
|
||||
Verifies that the --app option works.
|
||||
"""
|
||||
management.call_command('loaddata', 'db_fixture_1', verbosity=0, app_label="someotherapp")
|
||||
self.assertQuerysetEqual(Article.objects.all(), [])
|
||||
management.call_command('loaddata', 'db_fixture_1', verbosity=0, app_label="fixtures")
|
||||
self.assertQuerysetEqual(Article.objects.all(), [
|
||||
'<Article: Who needs more than one database?>',
|
||||
])
|
||||
|
||||
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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue