Skip to content

Commit

Permalink
feat: added test for pinning / unpinning
Browse files Browse the repository at this point in the history
  • Loading branch information
totalimmersion committed Dec 6, 2024
1 parent 7e4a6c8 commit 2b53100
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions stream_chat/tests/test_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,3 +377,30 @@ def test_export_channel(
assert "error" not in resp
break
time.sleep(0.5)

def test_pin_channel(self, client: StreamChat, channel: Channel, random_users: List[Dict]):
user_id = random_users[0]["id"]

# Pin the channel
response = channel.pin(user_id)
assert response is not None

# Query for pinned channels
response = client.query_channels(
{"pinned": True, "cid": channel.cid},
user_id=user_id
)
assert len(response["channels"]) == 1
assert response["channels"][0]["cid"] == channel.cid

# Unpin the channel
response = channel.unpin(user_id)
assert response is not None

# Query for pinned channels
response = client.query_channels(
{"pinned": False, "cid": channel.cid},
user_id=user_id
)
assert len(response["channels"]) == 1
assert response["channels"][0]["cid"] == channel.cid

0 comments on commit 2b53100

Please sign in to comment.