'Tests the RenameModel operation on a model which has a superclass that
has a foreign key.'

def test_rename_model_with_superclass_fk(self):

    project_state = self.set_up_test_model('test_rmwsc', related_model=True, mti_model=True)
    operation = migrations.RenameModel('ShetlandPony', 'LittleHorse')
    self.assertEqual(operation.describe(), 'Rename    model    ShetlandPony    to    LittleHorse')
    new_state = project_state.clone()
    operation.state_forwards('test_rmwsc', new_state)
    self.assertNotIn(('test_rmwsc', 'shetlandpony'), new_state.models)
    self.assertIn(('test_rmwsc', 'littlehorse'), new_state.models)
    self.assertEqual(project_state.models[('test_rmwsc', 'rider')].fields[1][1].remote_field.model, new_state.models[('test_rmwsc', 'rider')].fields[1][1].remote_field.model)
    self.assertTableExists('test_rmwsc_shetlandpony')
    self.assertTableNotExists('test_rmwsc_littlehorse')
    if connection.features.supports_foreign_keys:
        self.assertFKExists('test_rmwsc_rider', ['pony_id'], ('test_rmwsc_pony', 'id'))
        self.assertFKNotExists('test_rmwsc_rider', ['pony_id'], ('test_rmwsc_shetlandpony', 'id'))
    with connection.schema_editor() as editor:
        operation.database_forwards('test_rmwsc', editor, project_state, new_state)
    self.assertTableNotExists('test_rmwsc_shetlandpony')
    self.assertTableExists('test_rmwsc_littlehorse')
    if connection.features.supports_foreign_keys:
        self.assertFKExists('test_rmwsc_rider', ['pony_id'], ('test_rmwsc_pony', 'id'))
        self.assertFKNotExists('test_rmwsc_rider', ['pony_id'], ('test_rmwsc_littlehorse', 'id'))
