Esempio n. 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)
Esempio n. 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")
Esempio n. 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)
Esempio n. 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)
Esempio n. 5
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"], 0.3)
Esempio n. 6
0
 def test_alternate_prefix(self):
     pool_from_config({
         "noodle.url": "redis://localhost:1234/0",
     },
                      prefix="noodle.")
Esempio n. 7
0
 def test_empty_config(self):
     with self.assertRaises(ConfigurationError):
         pool_from_config({})
Esempio n. 8
0
 def test_alternate_prefix(self):
     pool_from_config({"noodle.url": "redis://localhost:1234/0"}, prefix="noodle.")
Esempio n. 9
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")
Esempio n. 10
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)
Esempio n. 11
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)
Esempio n. 12
0
 def test_empty_config(self):
     with self.assertRaises(ConfigurationError):
         pool_from_config({})