Пример #1
0
    def configure_redis(self):
        """Configure Redis connection pool."""
        from websauna.system.core import redis
        self.config.registry.redis = redis.create_redis(self.config.registry)

        # Add logging events
        self.config.scan(redis)
Пример #2
0
    def configure_redis(self):
        """Configure Redis connection pool."""
        from websauna.system.core import redis
        self.config.registry.redis = redis.create_redis(self.config.registry)

        # Add logging events
        self.config.scan(redis)
Пример #3
0
def app(request):
    """py.test fixture to set up a dummy app for Redis testing.

    :param request: pytest's FixtureRequest (internal class, cannot be hinted on a signature)
    """

    config = testing.setUp()
    config.add_route("home", "/")
    config.add_route("redis_test", "/redis_test")
    config.add_view(redis_test, route_name="redis_test")

    # same is in test.ini
    config.registry.settings[
        "redis.sessions.url"] = "redis://localhost:6379/14"

    def teardown():
        testing.tearDown()

    config.registry.redis = create_redis(config.registry)

    app = TestApp(config.make_wsgi_app())
    return app