'Tests serializing a simple migration.'

def test_simple_migration(self):

    fields = {'charfield': models.DateTimeField(default=datetime.datetime.utcnow), 'datetimefield': models.DateTimeField(default=datetime.datetime.utcnow)}
    options = {'verbose_name': 'My    model', 'verbose_name_plural': 'My    models'}
    migration = type('Migration', (migrations.Migration,), {'operations': [migrations.CreateModel('MyModel', tuple(fields.items()), options, (models.Model,)), migrations.CreateModel('MyModel2', tuple(fields.items()), bases=(models.Model,)), migrations.CreateModel(name='MyModel3', fields=tuple(fields.items()), options=options, bases=(models.Model,)), migrations.DeleteModel('MyModel'), migrations.AddField('OtherModel', 'datetimefield', fields['datetimefield'])], 'dependencies': [('testapp', 'some_other_one')]})
    writer = MigrationWriter(migration)
    output = writer.as_string()
    result = self.safe_exec(output)
    self.assertIn('Migration', result)
