'Tests running a squashed migration from zero (should ignore what it replaces)'

@override_settings(MIGRATION_MODULES={'migrations': 'migrations.test_migrations_squashed'})
def test_run_with_squashed(self):

    executor = MigrationExecutor(connection)
    leaves = [key for key in executor.loader.graph.leaf_nodes() if (key[0] == 'migrations')]
    self.assertEqual(leaves, [('migrations', '0001_squashed_0002')])
    plan = executor.migration_plan([('migrations', '0001_squashed_0002')])
    self.assertEqual(plan, [(executor.loader.graph.nodes[('migrations', '0001_squashed_0002')], False)])
    self.assertTableNotExists('migrations_author')
    self.assertTableNotExists('migrations_book')
    executor.migrate([('migrations', '0001_squashed_0002')])
    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', '0001_squashed_0002')], True)])
    executor.migrate([('migrations', None)])
    self.assertTableNotExists('migrations_author')
    self.assertTableNotExists('migrations_book')
