コード例 #1
0
    def test_max_connections(self):
        pool = pool_from_config({
            "redis.url": "redis://localhost:1234/0",
            "redis.max_connections": "300",
        })

        self.assertEqual(pool.max_connections, 300)
コード例 #2
0
    def test_kwargs_passthrough(self):
        pool = pool_from_config({
            "redis.url": "redis://localhost:1234/0",
        },
                                example="present")

        self.assertEqual(pool.connection_kwargs["example"], "present")
コード例 #3
0
    def test_basic_url(self):
        pool = pool_from_config({
            "redis.url": "redis://localhost:1234/0",
        })

        self.assertEqual(pool.connection_kwargs["host"], "localhost")
        self.assertEqual(pool.connection_kwargs["port"], 1234)
        self.assertEqual(pool.connection_kwargs["db"], 0)
コード例 #4
0
    def test_timeouts(self):
        pool = pool_from_config({
            "redis.url": "redis://localhost:1234/0",
            "redis.socket_timeout": "30 seconds",
            "redis.socket_connect_timeout": "300 milliseconds",
        })

        self.assertEqual(pool.connection_kwargs["socket_timeout"], 30)
        self.assertEqual(pool.connection_kwargs["socket_connect_timeout"], .3)
コード例 #5
0
ファイル: redis_tests.py プロジェクト: reddit/baseplate
    def test_timeouts(self):
        pool = pool_from_config(
            {
                "redis.url": "redis://localhost:1234/0",
                "redis.socket_timeout": "30 seconds",
                "redis.socket_connect_timeout": "300 milliseconds",
            }
        )

        self.assertEqual(pool.connection_kwargs["socket_timeout"], 30)
        self.assertEqual(pool.connection_kwargs["socket_connect_timeout"], 0.3)
コード例 #6
0
 def test_alternate_prefix(self):
     pool_from_config({
         "noodle.url": "redis://localhost:1234/0",
     },
                      prefix="noodle.")
コード例 #7
0
 def test_empty_config(self):
     with self.assertRaises(ConfigurationError):
         pool_from_config({})
コード例 #8
0
ファイル: redis_tests.py プロジェクト: reddit/baseplate
 def test_alternate_prefix(self):
     pool_from_config({"noodle.url": "redis://localhost:1234/0"}, prefix="noodle.")
コード例 #9
0
ファイル: redis_tests.py プロジェクト: reddit/baseplate
    def test_kwargs_passthrough(self):
        pool = pool_from_config({"redis.url": "redis://localhost:1234/0"}, example="present")

        self.assertEqual(pool.connection_kwargs["example"], "present")
コード例 #10
0
ファイル: redis_tests.py プロジェクト: reddit/baseplate
    def test_max_connections(self):
        pool = pool_from_config({"redis.url": "redis://localhost:1234/0", "redis.max_connections": "300"})

        self.assertEqual(pool.max_connections, 300)
コード例 #11
0
ファイル: redis_tests.py プロジェクト: reddit/baseplate
    def test_basic_url(self):
        pool = pool_from_config({"redis.url": "redis://localhost:1234/0"})

        self.assertEqual(pool.connection_kwargs["host"], "localhost")
        self.assertEqual(pool.connection_kwargs["port"], 1234)
        self.assertEqual(pool.connection_kwargs["db"], 0)
コード例 #12
0
ファイル: redis_tests.py プロジェクト: reddit/baseplate
 def test_empty_config(self):
     with self.assertRaises(ConfigurationError):
         pool_from_config({})