Skip to content

Commit ef3753f

Browse files
authored
Merge branch 'master' into cha-1230-delivery-receipts
2 parents a01d6c4 + bd46569 commit ef3753f

File tree

2 files changed

+36
-9
lines changed

2 files changed

+36
-9
lines changed

stream_chat/tests/async_chat/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ async def test_create_blocklist(self, client: StreamChatAsync):
726726

727727
async def test_list_blocklists(self, client: StreamChatAsync):
728728
response = await client.list_blocklists()
729-
assert len(response["blocklists"]) == 2
729+
assert len(response["blocklists"]) == 3
730730
blocklist_names = {blocklist["name"] for blocklist in response["blocklists"]}
731731
assert "Foo" in blocklist_names
732732

stream_chat/tests/test_client.py

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,42 @@ def test_get_app_settings(self, client: StreamChat):
128128
assert "app" in configs
129129

130130
def test_update_app_settings(self, client: StreamChat):
131-
client.update_app_settings(
132-
async_moderation_config={
133-
"callback": {
134-
"mode": "CALLBACK_MODE_REST",
135-
"server_url": "http://example.com/callback",
131+
response = client.update_app_settings(
132+
event_hooks=[
133+
{
134+
"hook_type": "webhook",
135+
"webhook_url": "https://example.com/webhook",
136+
"event_types": ["message.new", "message.updated"],
136137
},
137-
"timeout_ms": 10000, # how long messages should stay pending before being deleted
138-
}
138+
{
139+
"hook_type": "webhook",
140+
"webhook_url": "https://google.com",
141+
"event_types": [],
142+
},
143+
{
144+
"hook_type": "pending_message",
145+
"webhook_url": "http://google.com",
146+
"timeout_ms": 500,
147+
"callback": {
148+
"mode": "CALLBACK_MODE_REST",
149+
},
150+
},
151+
]
139152
)
153+
assert response.is_ok()
154+
155+
settings = client.get_app_settings()
156+
assert "app" in settings
157+
assert "event_hooks" in settings["app"]
158+
assert len(settings["app"]["event_hooks"]) == 3
159+
160+
response = client.update_app_settings(event_hooks=[])
161+
assert response.is_ok()
162+
163+
settings = client.get_app_settings()
164+
assert "app" in settings
165+
assert "event_hooks" in settings["app"]
166+
assert len(settings["app"]["event_hooks"]) == 0
140167

141168
def test_update_user(self, client: StreamChat):
142169
user = {"id": str(uuid.uuid4())}
@@ -703,7 +730,7 @@ def test_create_blocklist(self, client: StreamChat):
703730

704731
def test_list_blocklists(self, client: StreamChat):
705732
response = client.list_blocklists()
706-
assert len(response["blocklists"]) == 2
733+
assert len(response["blocklists"]) == 3
707734
blocklist_names = {blocklist["name"] for blocklist in response["blocklists"]}
708735
assert "Foo" in blocklist_names
709736

0 commit comments

Comments
 (0)