Tests the DeleteModel operation ignores proxy models.
(self)
| 733 | self.assertEqual(list(definition[2]), ["name"]) |
| 734 | |
| 735 | def test_delete_proxy_model(self): |
| 736 | """ |
| 737 | Tests the DeleteModel operation ignores proxy models. |
| 738 | """ |
| 739 | project_state = self.set_up_test_model("test_dlprmo", proxy_model=True) |
| 740 | # Test the state alteration |
| 741 | operation = migrations.DeleteModel("ProxyPony") |
| 742 | new_state = project_state.clone() |
| 743 | operation.state_forwards("test_dlprmo", new_state) |
| 744 | self.assertIn(("test_dlprmo", "proxypony"), project_state.models) |
| 745 | self.assertNotIn(("test_dlprmo", "proxypony"), new_state.models) |
| 746 | # Test the database alteration |
| 747 | self.assertTableExists("test_dlprmo_pony") |
| 748 | self.assertTableNotExists("test_dlprmo_proxypony") |
| 749 | with connection.schema_editor() as editor: |
| 750 | operation.database_forwards("test_dlprmo", editor, project_state, new_state) |
| 751 | self.assertTableExists("test_dlprmo_pony") |
| 752 | self.assertTableNotExists("test_dlprmo_proxypony") |
| 753 | # And test reversal |
| 754 | with connection.schema_editor() as editor: |
| 755 | operation.database_backwards( |
| 756 | "test_dlprmo", editor, new_state, project_state |
| 757 | ) |
| 758 | self.assertTableExists("test_dlprmo_pony") |
| 759 | self.assertTableNotExists("test_dlprmo_proxypony") |
| 760 | |
| 761 | def test_delete_mti_model(self): |
| 762 | project_state = self.set_up_test_model("test_dlmtimo", mti_model=True) |
nothing calls this directly
no test coverage detected