Skip to content

Commit

Permalink
enable tests for batch unread endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyPettersson85 committed Jan 30, 2024
1 parent 8063ba5 commit 661a580
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
23 changes: 13 additions & 10 deletions stream_chat/tests/async_chat/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,13 +813,16 @@ async def test_unread_counts(
assert response["channels"][0]["channel_id"] == channel.cid
assert len(response["channel_type"]) == 1

# PREP for new endpoint
# async def test_unread_counts_batch(self, client: StreamChatAsync, channel, random_users: Dict):
# await channel.add_members([x["id"] for x in random_users])
# msg_id = str(uuid.uuid4())
# await channel.send_message({"id": msg_id, "text": "helloworld"}, str(uuid.uuid4()))
# response = await client.unread_counts_batch([x["id"] for x in random_users])
# assert "counts_by_user" in response
# for user_id in [x["id"] for x in random_users]:
# assert user_id in response["counts_by_user"]
# assert response["counts_by_user"][user_id]["total_unread_count"] == 1
async def test_unread_counts_batch(
self, client: StreamChatAsync, channel, random_users: Dict
):
await channel.add_members([x["id"] for x in random_users])
msg_id = str(uuid.uuid4())
await channel.send_message(
{"id": msg_id, "text": "helloworld"}, str(uuid.uuid4())
)
response = await client.unread_counts_batch([x["id"] for x in random_users])
assert "counts_by_user" in response
for user_id in [x["id"] for x in random_users]:
assert user_id in response["counts_by_user"]
assert response["counts_by_user"][user_id]["total_unread_count"] == 1
19 changes: 9 additions & 10 deletions stream_chat/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,13 +789,12 @@ def test_unread_counts(self, client: StreamChat, channel, random_user: Dict):
assert response["channels"][0]["channel_id"] == channel.cid
assert len(response["channel_type"]) == 1

# PREP for new endpoint
# def test_unread_counts_batch(self, client: StreamChat, channel, random_users: Dict):
# channel.add_members([x["id"] for x in random_users])
# msg_id = str(uuid.uuid4())
# channel.send_message({"id": msg_id, "text": "helloworld"}, str(uuid.uuid4()))
# response = client.unread_counts_batch([x["id"] for x in random_users])
# assert "counts_by_user" in response
# for user_id in [x["id"] for x in random_users]:
# assert user_id in response["counts_by_user"]
# assert response["counts_by_user"][user_id]["total_unread_count"] == 1
def test_unread_counts_batch(self, client: StreamChat, channel, random_users: Dict):
channel.add_members([x["id"] for x in random_users])
msg_id = str(uuid.uuid4())
channel.send_message({"id": msg_id, "text": "helloworld"}, str(uuid.uuid4()))
response = client.unread_counts_batch([x["id"] for x in random_users])
assert "counts_by_user" in response
for user_id in [x["id"] for x in random_users]:
assert user_id in response["counts_by_user"]
assert response["counts_by_user"][user_id]["total_unread_count"] == 1

0 comments on commit 661a580

Please sign in to comment.