From 908160f6926506dc64244e9d5a4507bc67ea0a81 Mon Sep 17 00:00:00 2001
From: Tim Graham <timograham@gmail.com>
Date: Mon, 23 Jun 2014 08:45:06 -0400
Subject: [PATCH] Fixed test failures introduced by refs #22881.

---
 tests/migrations/test_commands.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py
index 7895259ccd..54d18ef371 100644
--- a/tests/migrations/test_commands.py
+++ b/tests/migrations/test_commands.py
@@ -97,11 +97,18 @@ class MigrateTests(MigrationTestBase):
         stdout = six.StringIO()
         call_command("sqlmigrate", "migrations", "0001", stdout=stdout)
         self.assertIn("create table", stdout.getvalue().lower())
+
+        # Cannot generate the reverse SQL unless we've applied the migration.
+        call_command("migrate", "migrations", verbosity=0)
+
         # 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())
 
+        # Cleanup by unmigrating everything
+        call_command("migrate", "migrations", "zero", verbosity=0)
+
     @override_system_checks([])
     @override_settings(
         INSTALLED_APPS=[