Kaydet (Commit) bf019c97 authored tarafından Andrew Godwin's avatar Andrew Godwin

[1.7.x] Fix router_honored test to not close connection

üst 55fa4c2d
...@@ -27,7 +27,7 @@ class SQLCommandsTestCase(TestCase): ...@@ -27,7 +27,7 @@ class SQLCommandsTestCase(TestCase):
def test_sql_delete(self): def test_sql_delete(self):
app_config = apps.get_app_config('commands_sql') app_config = apps.get_app_config('commands_sql')
output = sql_delete(app_config, no_style(), connections[DEFAULT_DB_ALIAS]) output = sql_delete(app_config, no_style(), connections[DEFAULT_DB_ALIAS], close_connection=False)
drop_tables = [o for o in output if o.startswith('DROP TABLE')] drop_tables = [o for o in output if o.startswith('DROP TABLE')]
self.assertEqual(len(drop_tables), 3) self.assertEqual(len(drop_tables), 3)
# Lower so that Oracle's upper case tbl names wont break # Lower so that Oracle's upper case tbl names wont break
...@@ -71,6 +71,9 @@ class SQLCommandsRouterTestCase(TestCase): ...@@ -71,6 +71,9 @@ class SQLCommandsRouterTestCase(TestCase):
def test_router_honored(self): def test_router_honored(self):
app_config = apps.get_app_config('commands_sql') app_config = apps.get_app_config('commands_sql')
for sql_command in (sql_all, sql_create, sql_delete, sql_indexes, sql_destroy_indexes): for sql_command in (sql_all, sql_create, sql_delete, sql_indexes, sql_destroy_indexes):
output = sql_command(app_config, no_style(), connections[DEFAULT_DB_ALIAS]) if sql_command is sql_delete:
output = sql_command(app_config, no_style(), connections[DEFAULT_DB_ALIAS], close_connection=False)
else:
output = sql_command(app_config, no_style(), connections[DEFAULT_DB_ALIAS])
self.assertEqual(len(output), 0, self.assertEqual(len(output), 0,
"%s command is not honoring routers" % sql_command.__name__) "%s command is not honoring routers" % sql_command.__name__)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment