Exemple #1
0
def _request_context(*args, **kwargs):
    """Provides a request with redis initialized."""

    with app.test_request_context(*args, **kwargs):
        # Unfortunately, flask does not provide decorated before/after
        # functions in this context, so we have to do this manually.
        g.db = redis_db.open_connection(1)
        load_fixture(get_fixture_path("0010_photos.json"))
        load_fixture(get_fixture_path("0011_photo_albums.json"))
        yield
Exemple #2
0
def _prepared_context(app):
    ctx = app.test_request_context()
    ctx.push()
    app.preprocess_request()
    yield
    ctx.pop()