diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-29 21:11:12 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-29 21:25:28 +0100 |
| commit | 1d4bcb86eab521aa3f9dfc52e77d8a51448aa0f7 (patch) | |
| tree | dec05fea657445452656bb18c421c3df624297b1 /tests/commands_sql | |
| parent | 38ce41103fecf58418163b19403608988a291b56 (diff) | |
Changed sql_* to use an app config instead of a models module.
Diffstat (limited to 'tests/commands_sql')
| -rw-r--r-- | tests/commands_sql/tests.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/commands_sql/tests.py b/tests/commands_sql/tests.py index 00f4017b9c..7ef28f83db 100644 --- a/tests/commands_sql/tests.py +++ b/tests/commands_sql/tests.py @@ -17,8 +17,8 @@ class SQLCommandsTestCase(TestCase): return len([o for o in output if o.startswith(cmd)]) def test_sql_create(self): - app = apps.get_app_config('commands_sql').models_module - output = sql_create(app, no_style(), connections[DEFAULT_DB_ALIAS]) + app_config = apps.get_app_config('commands_sql') + output = sql_create(app_config, no_style(), connections[DEFAULT_DB_ALIAS]) create_tables = [o for o in output if o.startswith('CREATE TABLE')] self.assertEqual(len(create_tables), 3) # Lower so that Oracle's upper case tbl names wont break @@ -26,8 +26,8 @@ class SQLCommandsTestCase(TestCase): six.assertRegex(self, sql, r'^create table .commands_sql_book.*') def test_sql_delete(self): - app = apps.get_app_config('commands_sql').models_module - output = sql_delete(app, no_style(), connections[DEFAULT_DB_ALIAS]) + app_config = apps.get_app_config('commands_sql') + output = sql_delete(app_config, no_style(), connections[DEFAULT_DB_ALIAS]) drop_tables = [o for o in output if o.startswith('DROP TABLE')] self.assertEqual(len(drop_tables), 3) # Lower so that Oracle's upper case tbl names wont break @@ -35,20 +35,20 @@ class SQLCommandsTestCase(TestCase): six.assertRegex(self, sql, r'^drop table .commands_sql_comment.*') def test_sql_indexes(self): - app = apps.get_app_config('commands_sql').models_module - output = sql_indexes(app, no_style(), connections[DEFAULT_DB_ALIAS]) + app_config = apps.get_app_config('commands_sql') + output = sql_indexes(app_config, no_style(), connections[DEFAULT_DB_ALIAS]) # PostgreSQL creates one additional index for CharField self.assertIn(self.count_ddl(output, 'CREATE INDEX'), [3, 4]) def test_sql_destroy_indexes(self): - app = apps.get_app_config('commands_sql').models_module - output = sql_destroy_indexes(app, no_style(), connections[DEFAULT_DB_ALIAS]) + app_config = apps.get_app_config('commands_sql') + output = sql_destroy_indexes(app_config, no_style(), connections[DEFAULT_DB_ALIAS]) # PostgreSQL creates one additional index for CharField self.assertIn(self.count_ddl(output, 'DROP INDEX'), [3, 4]) def test_sql_all(self): - app = apps.get_app_config('commands_sql').models_module - output = sql_all(app, no_style(), connections[DEFAULT_DB_ALIAS]) + app_config = apps.get_app_config('commands_sql') + output = sql_all(app_config, no_style(), connections[DEFAULT_DB_ALIAS]) self.assertEqual(self.count_ddl(output, 'CREATE TABLE'), 3) # PostgreSQL creates one additional index for CharField @@ -69,8 +69,8 @@ class SQLCommandsRouterTestCase(TestCase): router.routers = self._old_routers def test_router_honored(self): - app = apps.get_app_config('commands_sql').models_module + app_config = apps.get_app_config('commands_sql') for sql_command in (sql_all, sql_create, sql_delete, sql_indexes, sql_destroy_indexes): - output = sql_command(app, no_style(), connections[DEFAULT_DB_ALIAS]) + output = sql_command(app_config, no_style(), connections[DEFAULT_DB_ALIAS]) self.assertEqual(len(output), 0, "%s command is not honoring routers" % sql_command.__name__) |
