def test_create_tables_for_concrete_models(self, database): drop_tables() create_tables() # noinspection PyProtectedMember concrete_models = { model._meta.table_name for model in Base.get_concrete_descendants() } assert set(database.get_tables()) == concrete_models
def drop_tables(): for descendant in Base.get_concrete_descendants(): if descendant.table_exists(): descendant.drop_table()
def create_tables(): for descendant in Base.get_concrete_descendants(): descendant.create_table()