Simon Law avatar Simon Law committed 35f3f8e

More robust MigrationHistory test for test_alter_column_null

Comments (0)

Files changed (1)

south/tests/logic.py

                 cursor.execute("DELETE FROM southtest_spam")
                 transaction.commit()
                 return True
-        
+
+        MigrationHistory.objects.all().delete()
         migrations = Migrations("fakeapp")
-        self.assertEqual(list(MigrationHistory.objects.all()), [])
         
         # by default name is NOT NULL
         migrate_app(migrations, target_name="0002", fake=False)
         self.failIf(null_ok())
+        self.assertListEqual(
+            ((u"fakeapp", u"0001_spam"),
+             (u"fakeapp", u"0002_eggs"),),
+            MigrationHistory.objects.values_list("app_name", "migration"),
+        )
         
         # after 0003, it should be NULL
         migrate_app(migrations, target_name="0003", fake=False)
         self.assert_(null_ok())
+        self.assertListEqual(
+            ((u"fakeapp", u"0001_spam"),
+             (u"fakeapp", u"0002_eggs"),
+             (u"fakeapp", u"0003_alter_spam"),),
+            MigrationHistory.objects.values_list("app_name", "migration"),
+        )
 
         # make sure it is NOT NULL again
         migrate_app(migrations, target_name="0002", fake=False)
         self.failIf(null_ok(), 'name not null after migration')
+        self.assertListEqual(
+            ((u"fakeapp", u"0001_spam"),
+             (u"fakeapp", u"0002_eggs"),),
+            MigrationHistory.objects.values_list("app_name", "migration"),
+        )
         
         # finish with no migrations, otherwise other tests fail...
         migrate_app(migrations, target_name="zero", fake=False)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.