Exemplo n.º 1
0
    def setUp(self):
        app = create_app({
            'SQLALCHEMY_DATABASE_URI': DATABASE,
            'ZERQU_CACHE_TYPE': 'simple',
            'OAUTH_CACHE_TYPE': 'simple',
            'RATE_LIMITER_TYPE': 'cache',
            'SECRET_KEY': 'secret',
        })
        app.testing = True

        register_base(app)

        self._ctx = app.app_context()
        self._ctx.push()

        db.drop_all()
        db.create_all()
        self.app = app
        self.client = app.test_client()
Exemplo n.º 2
0
    def setUp(self):
        app = create_app(
            {
                "SQLALCHEMY_DATABASE_URI": DATABASE,
                "ZERQU_CACHE_TYPE": "simple",
                "OAUTH_CACHE_TYPE": "simple",
                "RATE_LIMITER_TYPE": "cache",
                "SECRET_KEY": "secret",
            }
        )
        app.testing = True
        self._ctx = app.app_context()
        self._ctx.push()

        db.init_app(app)

        db.drop_all()
        db.create_all()

        self.app = app
        self.client = app.test_client()
        self.prepare_data()
Exemplo n.º 3
0
def create_database():
    import fixtures
    with app.app_context():
        db.drop_all()
        db.create_all()
        fixtures.run()
Exemplo n.º 4
0
    formatter = logging.Formatter(
        '[%(levelname)s %(funcName)s %(filename)s:%(lineno)d]: %(message)s')
    handler = logging.StreamHandler(sys.stdout)
    handler.setFormatter(formatter)

    log = logging.getLogger('flask_oauthlib')
    log.addHandler(handler)
    log.setLevel(logging.DEBUG)

    log = logging.getLogger('oauthlib')
    log.addHandler(handler)
    log.setLevel(logging.DEBUG)


def create_database():
    import fixtures
    with app.app_context():
        db.drop_all()
        db.create_all()
        fixtures.run()


if '--initdb' in sys.argv:
    create_database()
    sys.exit()

with app.app_context():
    db.create_all()

app.run(host='0.0.0.0')
Exemplo n.º 5
0
def create_database():
    import fixtures
    with app.app_context():
        db.drop_all()
        db.create_all()
        fixtures.run()
Exemplo n.º 6
0
    )
    handler = logging.StreamHandler(sys.stdout)
    handler.setFormatter(formatter)

    log = logging.getLogger('flask_oauthlib')
    log.addHandler(handler)
    log.setLevel(logging.DEBUG)

    log = logging.getLogger('oauthlib')
    log.addHandler(handler)
    log.setLevel(logging.DEBUG)


def create_database():
    import fixtures
    with app.app_context():
        db.drop_all()
        db.create_all()
        fixtures.run()


if '--initdb' in sys.argv:
    create_database()
    sys.exit()


with app.app_context():
    db.create_all()

app.run(host='0.0.0.0')