summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2013-09-06 15:27:51 -0500
committerAndrew Godwin <andrew@aeracode.org>2013-09-06 15:28:12 -0500
commitefd1e6096ee87fe332cf989ba5479e9461d0fb3a (patch)
tree3c80b74328fa5d9efa5dd0344a213f4ae79566cf /tests
parent5ca290f5db3a5f735cdbdc7130c044192beb7f66 (diff)
Adding 'sqlmigrate' command and quote_parameter to support it.
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_commands.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py
index 7fc78f74b5..93c871988e 100644
--- a/tests/migrations/test_commands.py
+++ b/tests/migrations/test_commands.py
@@ -48,6 +48,20 @@ class MigrateTests(MigrationTestBase):
self.assertTableNotExists("migrations_tribble")
self.assertTableNotExists("migrations_book")
+ @override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"})
+ def test_sqlmigrate(self):
+ """
+ Makes sure that sqlmigrate does something.
+ """
+ # Test forwards. All the databases agree on CREATE TABLE, at least.
+ stdout = six.StringIO()
+ call_command("sqlmigrate", "migrations", "0001", stdout=stdout)
+ self.assertIn("create table", stdout.getvalue().lower())
+ # And backwards is a DROP TABLE
+ stdout = six.StringIO()
+ call_command("sqlmigrate", "migrations", "0001", stdout=stdout, backwards=True)
+ self.assertIn("drop table", stdout.getvalue().lower())
+
class MakeMigrationsTests(MigrationTestBase):
"""