1
0
mirror of https://github.com/django/django.git synced 2025-10-30 17:16:10 +00:00

[1.7.x] Fixed #23699 -- Prevented flush from loading initial data for apps with migrations.

Backport of dd1ea70779 from master.
This commit is contained in:
Tim Graham
2014-10-27 07:03:05 -04:00
parent e317d7fc72
commit 5cc8180a65
8 changed files with 71 additions and 3 deletions

View File

@@ -0,0 +1,31 @@
from django.test import TestCase
from django.core import management
from .models import Book
class TestNoInitialDataLoading(TestCase):
"""
Apps with migrations should ignore initial data. This test can be removed
in Django 1.9 when migrations become required and initial data is no longer
supported.
"""
available_apps = ['django.contrib.auth', 'django.contrib.contenttypes', 'fixtures_migration']
def test_migrate(self):
self.assertQuerysetEqual(Book.objects.all(), [])
management.call_command(
'migrate',
verbosity=0,
)
self.assertQuerysetEqual(Book.objects.all(), [])
def test_flush(self):
self.assertQuerysetEqual(Book.objects.all(), [])
management.call_command(
'flush',
verbosity=0,
interactive=False,
load_initial_data=False
)
self.assertQuerysetEqual(Book.objects.all(), [])