1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fix some small errors in the tests

This commit is contained in:
Andrew Godwin
2013-08-23 12:07:43 +01:00
parent beefac8aae
commit ac45f9c9c5
4 changed files with 18 additions and 10 deletions

View File

@@ -127,12 +127,13 @@ class OperationTests(MigrationTestBase):
self.assertTableExists("test_adflmm_pony_stables")
self.assertColumnNotExists("test_adflmm_pony", "stables")
# Make sure the M2M field actually works
app_cache = new_state.render()
Pony = app_cache.get_model("test_adflmm", "Pony")
p = Pony.objects.create(pink=False, weight=4.55)
p.stables.create()
self.assertEqual(p.stables.count(), 1)
p.stables.all().delete()
with atomic():
app_cache = new_state.render()
Pony = app_cache.get_model("test_adflmm", "Pony")
p = Pony.objects.create(pink=False, weight=4.55)
p.stables.create()
self.assertEqual(p.stables.count(), 1)
p.stables.all().delete()
# And test reversal
with connection.schema_editor() as editor:
operation.database_backwards("test_adflmm", editor, new_state, project_state)