def test_redis_default(self): settings = dict() server = connection.from_settings(settings) connect_args = server.connection_pool.connection_kwargs self.assertEqual(connect_args['host'], 'localhost') self.assertEqual(connect_args['port'], 6379)
def test_redis_host_port(self): settings = dict( REDIS_HOST = 'localhost', REDIS_PORT = 9001 ) server = connection.from_settings(settings) connect_args = server.connection_pool.connection_kwargs self.assertEqual(connect_args['host'], 'localhost') self.assertEqual(connect_args['port'], 9001)
def test_redis_host_port_fallback(self): settings = dict( REDIS_HOST = 'baz', REDIS_PORT = 1337, REDIS_URL = None ) server = connection.from_settings(settings) connect_args = server.connection_pool.connection_kwargs self.assertEqual(connect_args['host'], 'baz') self.assertEqual(connect_args['port'], 1337)
def test_redis_url(self): settings = dict( REDIS_URL = 'redis://*****:*****@localhost:9001/42' ) server = connection.from_settings(settings) connect_args = server.connection_pool.connection_kwargs self.assertEqual(connect_args['host'], 'localhost') self.assertEqual(connect_args['port'], 9001) self.assertEqual(connect_args['password'], 'bar') self.assertEqual(connect_args['db'], 42)