Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated syncdb -> migrate in tests.

  • Loading branch information...
commit 3db66b1d65c12a94476017cbcc86e72fd842d29e 1 parent 8f7f8bf
Tim Graham timgraham authored
2  tests/fixtures/tests.py
View
@@ -48,7 +48,7 @@ def _dumpdata_assert(self, args, output, format='json', natural_keys=False,
class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
def test_initial_data(self):
- # syncdb introduces 1 initial data object from initial_data.json.
+ # migrate introduces 1 initial data object from initial_data.json.
self.assertQuerysetEqual(Book.objects.all(), [
'<Book: Achieving self-awareness of Python programs>'
])
6 tests/fixtures_model_package/tests.py
View
@@ -30,12 +30,12 @@ class TestNoInitialDataLoading(TransactionTestCase):
available_apps = ['fixtures_model_package']
- def test_syncdb(self):
+ def test_migrate(self):
with transaction.atomic():
Book.objects.all().delete()
management.call_command(
- 'syncdb',
+ 'migrate',
verbosity=0,
load_initial_data=False
)
@@ -64,7 +64,7 @@ def test_flush(self):
class FixtureTestCase(TestCase):
def test_initial_data(self):
"Fixtures can load initial data into models defined in packages"
- # syncdb introduces 1 initial data object from initial_data.json
+ # migrate introduces 1 initial data object from initial_data.json
self.assertQuerysetEqual(
Book.objects.all(), [
'Achieving self-awareness of Python programs'
2  tests/initial_sql_regress/tests.py
View
@@ -24,7 +24,7 @@ def test_initial_sql(self):
def test_custom_sql(self):
"""
- Simulate the custom SQL loading by syncdb.
+ Simulate the custom SQL loading by migrate.
"""
connection = connections[DEFAULT_DB_ALIAS]
custom_sql = custom_sql_for_model(Simple, no_style(), connection)
2  tests/m2m_regress/models.py
View
@@ -57,7 +57,7 @@ class Worksheet(models.Model):
# Regression for #11226 -- A model with the same name that another one to
# which it has a m2m relation. This shouldn't cause a name clash between
# the automatically created m2m intermediary table FK field names when
-# running syncdb
+# running migrate
class User(models.Model):
name = models.CharField(max_length=30)
friends = models.ManyToManyField(auth.User)
0  tests/syncdb_signals/__init__.py → tests/migrate_signals/__init__.py
View
File renamed without changes
0  tests/migrate_signals/models.py
View
No changes.
50 tests/syncdb_signals/tests.py → tests/migrate_signals/tests.py
View
@@ -6,13 +6,13 @@
from . import models
-PRE_SYNCDB_ARGS = ['app', 'create_models', 'verbosity', 'interactive', 'db']
-SYNCDB_DATABASE = 'default'
-SYNCDB_VERBOSITY = 1
-SYNCDB_INTERACTIVE = False
+PRE_MIGRATE_ARGS = ['app', 'create_models', 'verbosity', 'interactive', 'db']
+MIGRATE_DATABASE = 'default'
+MIGRATE_VERBOSITY = 1
+MIGRATE_INTERACTIVE = False
-class PreSyncdbReceiver(object):
+class PreMigrateReceiver(object):
def __init__(self):
self.call_counter = 0
self.call_args = None
@@ -24,7 +24,7 @@ def __call__(self, signal, sender, **kwargs):
class OneTimeReceiver(object):
"""
- Special receiver for handle the fact that test runner calls syncdb for
+ Special receiver for handle the fact that test runner calls migrate for
several databases and several times for some of them.
"""
@@ -33,13 +33,13 @@ def __init__(self):
self.call_args = None
def __call__(self, signal, sender, **kwargs):
- # Although test runner calls syncdb for several databases,
+ # Although test runner calls migrate for several databases,
# testing for only one of them is quite sufficient.
- if kwargs['db'] == SYNCDB_DATABASE:
+ if kwargs['db'] == MIGRATE_DATABASE:
self.call_counter = self.call_counter + 1
self.call_args = kwargs
- # we need to test only one call of syncdb
- signals.pre_syncdb.disconnect(pre_syncdb_receiver, sender=models)
+ # we need to test only one call of migrate
+ signals.pre_migrate.disconnect(pre_migrate_receiver, sender=models)
# We connect receiver here and not in unit test code because we need to
@@ -48,32 +48,32 @@ def __call__(self, signal, sender, **kwargs):
#
# 1. Test runner imports this module.
# 2. We connect receiver.
-# 3. Test runner calls syncdb for create default database.
+# 3. Test runner calls migrate for create default database.
# 4. Test runner execute our unit test code.
-pre_syncdb_receiver = OneTimeReceiver()
-signals.pre_syncdb.connect(pre_syncdb_receiver, sender=models)
+pre_migrate_receiver = OneTimeReceiver()
+signals.pre_migrate.connect(pre_migrate_receiver, sender=models)
-class SyncdbSignalTests(TestCase):
+class MigrateSignalTests(TestCase):
available_apps = [
- 'syncdb_signals',
+ 'migrate_signals',
]
- def test_pre_syncdb_call_time(self):
- self.assertEqual(pre_syncdb_receiver.call_counter, 1)
+ def test_pre_migrate_call_time(self):
+ self.assertEqual(pre_migrate_receiver.call_counter, 1)
- def test_pre_syncdb_args(self):
- r = PreSyncdbReceiver()
- signals.pre_syncdb.connect(r, sender=models)
- management.call_command('syncdb', database=SYNCDB_DATABASE,
- verbosity=SYNCDB_VERBOSITY, interactive=SYNCDB_INTERACTIVE,
+ def test_pre_migrate_args(self):
+ r = PreMigrateReceiver()
+ signals.pre_migrate.connect(r, sender=models)
+ management.call_command('migrate', database=MIGRATE_DATABASE,
+ verbosity=MIGRATE_VERBOSITY, interactive=MIGRATE_INTERACTIVE,
load_initial_data=False, stdout=six.StringIO())
args = r.call_args
self.assertEqual(r.call_counter, 1)
- self.assertEqual(set(args), set(PRE_SYNCDB_ARGS))
+ self.assertEqual(set(args), set(PRE_MIGRATE_ARGS))
self.assertEqual(args['app'], models)
- self.assertEqual(args['verbosity'], SYNCDB_VERBOSITY)
- self.assertEqual(args['interactive'], SYNCDB_INTERACTIVE)
+ self.assertEqual(args['verbosity'], MIGRATE_VERBOSITY)
+ self.assertEqual(args['interactive'], MIGRATE_INTERACTIVE)
self.assertEqual(args['db'], 'default')
16 tests/multiple_database/tests.py
View
@@ -1019,7 +1019,7 @@ def test_db_selection(self):
self.assertEqual(Book.objects.db_manager('default').db, 'default')
self.assertEqual(Book.objects.db_manager('default').all().db, 'default')
- def test_syncdb_selection(self):
+ def test_migrate_selection(self):
"Synchronization behavior is predictable"
self.assertTrue(router.allow_migrate('default', User))
@@ -1921,7 +1921,7 @@ def allow_migrate(self, db, model):
return db == DEFAULT_DB_ALIAS
-class SyncDBTestCase(TestCase):
+class MigrateTestCase(TestCase):
available_apps = [
'multiple_database',
@@ -1930,27 +1930,27 @@ class SyncDBTestCase(TestCase):
]
multi_db = True
- def test_syncdb_to_other_database(self):
- """Regression test for #16039: syncdb with --database option."""
+ def test_migrate_to_other_database(self):
+ """Regression test for #16039: migrate with --database option."""
cts = ContentType.objects.using('other').filter(app_label='multiple_database')
count = cts.count()
self.assertGreater(count, 0)
cts.delete()
- management.call_command('syncdb', verbosity=0, interactive=False,
+ management.call_command('migrate', verbosity=0, interactive=False,
load_initial_data=False, database='other')
self.assertEqual(cts.count(), count)
- def test_syncdb_to_other_database_with_router(self):
- """Regression test for #16039: syncdb with --database option."""
+ def test_migrate_to_other_database_with_router(self):
+ """Regression test for #16039: migrate with --database option."""
cts = ContentType.objects.using('other').filter(app_label='multiple_database')
cts.delete()
try:
old_routers = router.routers
router.routers = [SyncOnlyDefaultDatabaseRouter()]
- management.call_command('syncdb', verbosity=0, interactive=False,
+ management.call_command('migrate', verbosity=0, interactive=False,
load_initial_data=False, database='other')
finally:
router.routers = old_routers
6 tests/proxy_model_inheritance/tests.py
View
@@ -17,9 +17,9 @@
@override_settings(INSTALLED_APPS=('app1', 'app2'))
class ProxyModelInheritanceTests(TransactionTestCase):
"""
- Proxy model inheritance across apps can result in syncdb not creating the table
+ Proxy model inheritance across apps can result in migrate not creating the table
for the proxied model (as described in #12286). This test creates two dummy
- apps and calls syncdb, then verifies that the table has been created.
+ apps and calls migrate, then verifies that the table has been created.
"""
available_apps = []
@@ -42,7 +42,7 @@ def tearDown(self):
def test_table_exists(self):
try:
cache.set_available_apps(settings.INSTALLED_APPS)
- call_command('syncdb', verbosity=0)
+ call_command('migrate', verbosity=0)
finally:
cache.unset_available_apps()
from .app1.models import ProxyModel
2  tests/schema/models.py
View
@@ -3,7 +3,7 @@
# Because we want to test creation and deletion of these as separate things,
# these models are all inserted into a separate AppCache so the main test
-# runner doesn't syncdb them.
+# runner doesn't migrate them.
new_app_cache = BaseAppCache()
4 tests/swappable_models/tests.py
View
@@ -38,9 +38,9 @@ def test_generated_data(self):
Permission.objects.filter(content_type__app_label='swappable_models').delete()
ContentType.objects.filter(app_label='swappable_models').delete()
- # Re-run syncdb. This will re-build the permissions and content types.
+ # Re-run migrate. This will re-build the permissions and content types.
new_io = StringIO()
- management.call_command('syncdb', load_initial_data=False, interactive=False, stdout=new_io)
+ management.call_command('migrate', load_initial_data=False, interactive=False, stdout=new_io)
# Check that content types and permissions exist for the swapped model,
# but not for the swappable model.
11 tests/syncdb_signals/models.py
View
@@ -1,11 +0,0 @@
-# from django.db import models
-
-
-# class Author(models.Model):
-# name = models.CharField(max_length=100)
-
-# class Meta:
-# ordering = ['name']
-
-# def __unicode__(self):
-# return self.name
2  tests/tablespaces/models.py
View
@@ -4,7 +4,7 @@
# to create the tables for models where db_tablespace is set. To avoid this
# problem, we mark the models as unmanaged, and temporarily revert them to
# managed during each test. We also set them to use the same tables as the
-# "reference" models to avoid errors when other tests run 'syncdb'
+# "reference" models to avoid errors when other tests run 'migrate'
# (proxy_models_inheritance does).
class ScientistRef(models.Model):
Please sign in to comment.
Something went wrong with that request. Please try again.