def setUp(self): config = {'TESTING': True} config['SECRET_KEY'] = 'secret-key-for-test' self.db_fd, self.db_file = tempfile.mkstemp() config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///%s' % self.db_file app = create_app(config) self.app = app self.client = app.test_client() db.create_all() if hasattr(self, 'prehook'): self.prehook()
def setUp(self): config = {'TESTING': True} config['SECRET_KEY'] = 'secret-key-for-test' config['WWW_ROOT'] = 'tests/data' self.db_fd, self.db_file = tempfile.mkstemp() config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///%s' % self.db_file app = create_app(config) self.app = app self.client = app.test_client() db.create_all() if hasattr(self, 'prehook'): self.prehook()
def createdb(): """Create a database.""" from yuan.models import db db.create_all()