def app(): app = create_app() app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/alayatodo_test.db' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['TESTING'] = True db.init_app(app) with app.app_context(): from alayatodo.views import * # noqa db.create_all() yield app db.session.remove() db.drop_all()
def setUp(self): db.app = app db.create_all() db_seed()
def __init__(self): """ in case the tables haven't been created already""" db.drop_all() db.create_all()
#!/usr/bin/env python from migrate.versioning import api from config import SQLALCHEMY_DATABASE_URI from config import SQLALCHEMY_MIGRATE_REPO from alayatodo import db import os.path db.create_all() if not os.path.exists(SQLALCHEMY_MIGRATE_REPO): api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository') api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO) else: api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
def setUp(self): db.app = app db.create_all() db_seed() self.client = app.test_client()