def mktestbed(): from shorty import app db_fd, tmp_file = tempfile.mkstemp() full_db_uri = 'sqlite:///%s' % tmp_file app.config['DATABASE'] = tmp_file app.config['DB_FD'] = db_fd app.config['DATABASE_URI'] = full_db_uri app.config['SQLALCHEMY_DATABASE_URI'] = full_db_uri app.config['TESTING'] = True from shorty.database import init_db init_db()
# -*- coding: utf-8 -*- from shorty import app # load the middleware from werkzeug # This middleware can be applied to add HTTP proxy support to an application # that was not designed with HTTP proxies in mind. # It sets `REMOTE_ADDR`, `HTTP_POST` from `X-Forwarded` headers. from werkzeug.contrib.fixers import ProxyFix try: from shorty import settings except ImportError: import logging import sys logging.error('Could not find settings. Aborting...') sys.exit(1) app.config.from_object(settings) from shorty.routes import * from shorty.database import init_db init_db() app.wsgi_app = ProxyFix(app.wsgi_app)
def setUp(self): init_db()