Exemple #1
0
def load_dump(app, filename="data.json"):
    """
    Loads a fixture from a file.

    :param filename: Filename to load the JSON dump from.
    """

    from rdrei.utils.redis_fixtures import load_fixture
    with _prepared_context(app):
        load_fixture(filename)
Exemple #2
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