MCPcopy
hub / github.com/django/django / test_delete_mti_model

Method test_delete_mti_model

tests/migrations/test_operations.py:761–786  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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)
763 # Test the state alteration
764 operation = migrations.DeleteModel("ShetlandPony")
765 new_state = project_state.clone()
766 operation.state_forwards("test_dlmtimo", new_state)
767 self.assertIn(("test_dlmtimo", "shetlandpony"), project_state.models)
768 self.assertNotIn(("test_dlmtimo", "shetlandpony"), new_state.models)
769 # Test the database alteration
770 self.assertTableExists("test_dlmtimo_pony")
771 self.assertTableExists("test_dlmtimo_shetlandpony")
772 self.assertColumnExists("test_dlmtimo_shetlandpony", "pony_ptr_id")
773 with connection.schema_editor() as editor:
774 operation.database_forwards(
775 "test_dlmtimo", editor, project_state, new_state
776 )
777 self.assertTableExists("test_dlmtimo_pony")
778 self.assertTableNotExists("test_dlmtimo_shetlandpony")
779 # And test reversal
780 with connection.schema_editor() as editor:
781 operation.database_backwards(
782 "test_dlmtimo", editor, new_state, project_state
783 )
784 self.assertTableExists("test_dlmtimo_pony")
785 self.assertTableExists("test_dlmtimo_shetlandpony")
786 self.assertColumnExists("test_dlmtimo_shetlandpony", "pony_ptr_id")
787
788 def test_rename_model(self):
789 """

Callers

nothing calls this directly

Calls 9

state_forwardsMethod · 0.95
database_forwardsMethod · 0.95
database_backwardsMethod · 0.95
schema_editorMethod · 0.80
set_up_test_modelMethod · 0.45
cloneMethod · 0.45
assertTableExistsMethod · 0.45
assertColumnExistsMethod · 0.45
assertTableNotExistsMethod · 0.45

Tested by

no test coverage detected