'Tests running a simple set of migrations.'

@override_settings(MIGRATION_MODULES={'migrations': 'migrations.test_migrations'})
def test_run(self):

    executor = MigrationExecutor(connection)
    plan = executor.migration_plan([('migrations', '0002_second')])
    self.assertEqual(plan, [(executor.loader.graph.nodes[('migrations', '0001_initial')], False), (executor.loader.graph.nodes[('migrations', '0002_second')], False)])
    self.assertTableNotExists('migrations_author')
    self.assertTableNotExists('migrations_book')
    executor.migrate([('migrations', '0002_second')])
    self.assertTableExists('migrations_author')
    self.assertTableExists('migrations_book')
    executor.loader.build_graph()
    plan = executor.migration_plan([('migrations', None)])
    self.assertEqual(plan, [(executor.loader.graph.nodes[('migrations', '0002_second')], True), (executor.loader.graph.nodes[('migrations', '0001_initial')], True)])
    executor.migrate([('migrations', None)])
    self.assertTableNotExists('migrations_author')
    self.assertTableNotExists('migrations_book')
