summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-09-21 00:29:13 +0200
committerClaude Paroz <claude@2xlibre.net>2014-09-23 20:13:31 +0200
commit2a1bdf5ced3f22c2ff687afab45d811cfa555e74 (patch)
tree1ed30e4b2915e4763f88b02199cb470290209154 /tests
parented297061a676e629983664031d77da1d0a70af7d (diff)
Called table_names instead of get_table_list in migrations
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_base.py4
-rw-r--r--tests/migrations/test_executor.py8
2 files changed, 6 insertions, 6 deletions
diff --git a/tests/migrations/test_base.py b/tests/migrations/test_base.py
index 839929d087..ca733a72d1 100644
--- a/tests/migrations/test_base.py
+++ b/tests/migrations/test_base.py
@@ -15,11 +15,11 @@ class MigrationTestBase(TransactionTestCase):
def assertTableExists(self, table):
with connection.cursor() as cursor:
- self.assertIn(table, connection.introspection.get_table_list(cursor))
+ self.assertIn(table, connection.introspection.table_names(cursor))
def assertTableNotExists(self, table):
with connection.cursor() as cursor:
- self.assertNotIn(table, connection.introspection.get_table_list(cursor))
+ self.assertNotIn(table, connection.introspection.table_names(cursor))
def assertColumnExists(self, table, column):
self.assertIn(column, [c.name for c in self.get_table_description(table)])
diff --git a/tests/migrations/test_executor.py b/tests/migrations/test_executor.py
index 469f00f705..222f1b847e 100644
--- a/tests/migrations/test_executor.py
+++ b/tests/migrations/test_executor.py
@@ -213,18 +213,18 @@ class ExecutorTests(MigrationTestBase):
self.assertTableExists("migrations_author")
self.assertTableExists("migrations_tribble")
# Make sure the soft-application detection works (#23093)
- # Change get_table_list to not return auth_user during this as
+ # Change table_names to not return auth_user during this as
# it wouldn't be there in a normal run, and ensure migrations.Author
# exists in the global app registry temporarily.
- old_get_table_list = connection.introspection.get_table_list
- connection.introspection.get_table_list = lambda c: [x for x in old_get_table_list(c) if x != "auth_user"]
+ old_table_names = connection.introspection.table_names
+ connection.introspection.table_names = lambda c: [x for x in old_table_names(c) if x != "auth_user"]
migrations_apps = executor.loader.project_state(("migrations", "0001_initial")).render()
global_apps.get_app_config("migrations").models["author"] = migrations_apps.get_model("migrations", "author")
try:
migration = executor.loader.get_migration("auth", "0001_initial")
self.assertEqual(executor.detect_soft_applied(migration), True)
finally:
- connection.introspection.get_table_list = old_get_table_list
+ connection.introspection.table_names = old_table_names
del global_apps.get_app_config("migrations").models["author"]
# And migrate back to clean up the database
executor.loader.build_graph()