Example #1
0
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')
Example #2
0
    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
Example #3
0
def migrate(direction):
    """Migrate db revision"""
    migration = Migration(app)
    migration.migrate(direction)
Example #4
0
def migration(message):
    """Create migration file"""
    migration = Migration(app)
    migration.migration(message)
Example #5
0
def alembic():
    """Initialize alembic"""
    migration = Migration(app)
    migration.init()