Example #1
0
 def testDirectAppy(self):
     command = "create table xxx (yyy integer primary key);"
     creator = MigrationCreator("migration_test", locationInTestspace())
     target = creator.createMigration()
     self.assertFolderExists("migration_test", target)
     writeToFile(locationInTestspace("migration_test", target, "up"), command)
     conf = Config()
     conf.fromMap(testConfig)
     migrator = MigrationApplier(locationInTestspace(), conf)
     migrator.plugin = FakeDatabasePlugin(self)
     migrator.applySingleMigration(target)
     migrator.plugin.assertCommandWasExecuted(command)
Example #2
0
 def testRollback(self):
     command = "create table xxx (yyy integer primary key); alter blah blah blah;"
     target = MigrationCreator("migration_test", locationInTestspace()).createMigration()
     self.assertFolderExists("migration_test", target)
     writeToFile(locationInTestspace("migration_test", target, "up"), command)
     conf = Config()
     conf.fromMap(testConfig)
     migrator = MigrationApplier(locationInTestspace(), conf)
     migrator.plugin = FakeDatabasePlugin(self)
     try:
         migrator.applyMigration(target)
     except:
         pass
     migrator.plugin.assertNoCommandWasExecuted()