Skip to content

Commit a5e4dad

Browse files
add test case for !134
1 parent 528cf42 commit a5e4dad

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/test_broadcast.py

+15
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,21 @@ async def test_redis_stream():
7171
assert event.message == "hello"
7272

7373

74+
@pytest.mark.asyncio
75+
async def test_redis_resubscription():
76+
async with Broadcast("redis://localhost:6379") as broadcast:
77+
async with broadcast.subscribe("chatroom") as subscriber:
78+
await broadcast.publish("chatroom", "hello")
79+
event = await subscriber.get()
80+
assert event.channel == "chatroom"
81+
82+
await asyncio.sleep(0)
83+
async with broadcast.subscribe("chatroom2") as subscriber:
84+
await broadcast.publish("chatroom2", "hello")
85+
event = await subscriber.get()
86+
assert event.channel == "chatroom2"
87+
88+
7489
@pytest.mark.asyncio
7590
async def test_postgres():
7691
async with Broadcast("postgres://postgres:postgres@localhost:5432/broadcaster") as broadcast:

0 commit comments

Comments
 (0)