Skip to content

Commit e77f7f8

Browse files
author
Rafael Marinho
committed
fix unit tesrts
1 parent e9f5339 commit e77f7f8

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

stream_chat/client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,11 @@ def mark_delivered(self, data: Dict[str, Any]) -> Optional[StreamResponse]:
955955
if not data.get("user") and not data.get("user_id"):
956956
raise ValueError("either user or user_id must be provided")
957957

958+
# Extract user_id from data
959+
user_id = data.get("user_id") or data.get("user", {}).get("id")
960+
if not user_id:
961+
raise ValueError("user_id must be provided")
962+
958963
params = {"user_id": user_id}
959964
return self.post("channels/delivered", data=data, params=params)
960965

stream_chat/tests/async_chat/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from contextlib import suppress
77
from datetime import datetime
88
from operator import itemgetter
9-
from typing import Dict, List
9+
from typing import Dict, List, Any, Optional
1010

1111
import aiohttp
1212
import jwt
@@ -15,7 +15,7 @@
1515
from stream_chat.async_chat import StreamChatAsync
1616
from stream_chat.async_chat.channel import Channel
1717
from stream_chat.base.exceptions import StreamAPIException
18-
from stream_chat.tests.async_chat.conftest import hard_delete_users
18+
from stream_chat.tests.async_chat.conftest import hard_delete_users, cleanup_blocklists_async
1919
from stream_chat.tests.utils import wait_for_async
2020

2121

stream_chat/tests/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from contextlib import suppress
77
from datetime import datetime
88
from operator import itemgetter
9-
from typing import Dict, List
9+
from typing import Dict, List, Any, Optional
1010

1111
import jwt
1212
import pytest
@@ -15,7 +15,7 @@
1515
from stream_chat import StreamChat
1616
from stream_chat.base.exceptions import StreamAPIException
1717
from stream_chat.channel import Channel
18-
from stream_chat.tests.conftest import hard_delete_users
18+
from stream_chat.tests.conftest import hard_delete_users, cleanup_blocklists
1919
from stream_chat.tests.utils import wait_for
2020

2121

0 commit comments

Comments
 (0)