'Permissions and content types are not created for a swapped model'

@override_settings(TEST_ARTICLE_MODEL='swappable_models.AlternateArticle')
def test_generated_data(self):

    Permission.objects.filter(content_type__app_label='swappable_models').delete()
    ContentType.objects.filter(app_label='swappable_models').delete()
    new_io = StringIO()
    management.call_command('migrate', interactive=False, stdout=new_io)
    apps_models = [(p.content_type.app_label, p.content_type.model) for p in Permission.objects.all()]
    self.assertIn(('swappable_models', 'alternatearticle'), apps_models)
    self.assertNotIn(('swappable_models', 'article'), apps_models)
    apps_models = [(ct.app_label, ct.model) for ct in ContentType.objects.all()]
    self.assertIn(('swappable_models', 'alternatearticle'), apps_models)
    self.assertNotIn(('swappable_models', 'article'), apps_models)
