pythonasyncioeventletgeventlong-pollinglow-latencysocket-iosocketiosocketio-serverweb-serverwebsocket
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.0 KiB
30 lines
1.0 KiB
import pytest
|
|
|
|
from fastsio.redis_manager import parse_redis_sentinel_url
|
|
|
|
|
|
class TestPubSubManager:
|
|
def test_sentinel_url_parser(self):
|
|
with pytest.raises(ValueError):
|
|
parse_redis_sentinel_url("redis://localhost:6379/0")
|
|
|
|
assert parse_redis_sentinel_url("redis+sentinel://localhost:6379") == (
|
|
[("localhost", 6379)],
|
|
None,
|
|
{},
|
|
)
|
|
assert parse_redis_sentinel_url(
|
|
"redis+sentinel://192.168.0.1:6379,192.168.0.2:6379/"
|
|
) == ([("192.168.0.1", 6379), ("192.168.0.2", 6379)], None, {})
|
|
assert parse_redis_sentinel_url("redis+sentinel://h1:6379,h2:6379/0") == (
|
|
[("h1", 6379), ("h2", 6379)],
|
|
None,
|
|
{"db": 0},
|
|
)
|
|
assert parse_redis_sentinel_url(
|
|
"redis+sentinel://user:password@h1:6379,h2:6379,h1:6380/0/myredis"
|
|
) == (
|
|
[("h1", 6379), ("h2", 6379), ("h1", 6380)],
|
|
"myredis",
|
|
{"username": "user", "password": "password", "db": 0},
|
|
)
|
|
|