class TestCase(testing.TestCase): def create_app(self): app = Flask(config.APP_NAME) app = create_app(app) app.config["TESTING"] = True if app.config.get('TEST_DB_URI') is None: raise TestCaseDBException("No TEST_DB_URI specified in config.py!") app.config['SQLALCHEMY_DATABASE_URI'] = app.config.get('TEST_DB_URI') self.migration = Migration(app) return app def setUp(self): self.migration.migrate('up') def tearDown(self): self.migration.migrate('base')
def create_app(self): app = Flask(config.APP_NAME) app = create_app(app) app.config["TESTING"] = True if app.config.get('TEST_DB_URI') is None: raise TestCaseDBException("No TEST_DB_URI specified in config.py!") app.config['SQLALCHEMY_DATABASE_URI'] = app.config.get('TEST_DB_URI') self.migration = Migration(app) return app
def migrate(direction): """Migrate db revision""" migration = Migration(app) migration.migrate(direction)
def migration(message): """Create migration file""" migration = Migration(app) migration.migration(message)
def alembic(): """Initialize alembic""" migration = Migration(app) migration.init()