From 76de37c2f7c2dc83776235d45c702295a00aee17 Mon Sep 17 00:00:00 2001 From: Aditya Alif Nugraha Date: Fri, 3 Oct 2025 15:17:20 +0200 Subject: [PATCH 1/8] Fix failing webhook tests --- stream_chat/tests/test_client.py | 34 ++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/stream_chat/tests/test_client.py b/stream_chat/tests/test_client.py index 4361169..a365fc4 100644 --- a/stream_chat/tests/test_client.py +++ b/stream_chat/tests/test_client.py @@ -128,16 +128,38 @@ def test_get_app_settings(self, client: StreamChat): assert "app" in configs def test_update_app_settings(self, client: StreamChat): + # Get current app settings to verify event hooks support + response = client.get_app_settings() + assert "app" in response + client.update_app_settings( - async_moderation_config={ - "callback": { - "mode": "CALLBACK_MODE_REST", - "server_url": "http://example.com/callback", + event_hooks=[ + { + "enabled": True, + "hook_type": "webhook", + "webhook_url": "https://example.com/webhook", + "event_types": ["message.new", "message.updated"], }, - "timeout_ms": 10000, # how long messages should stay pending before being deleted - } + { + "enabled": True, + "hook_type": "webhook", + "webhook_url": "https://secondary-webhook-url.com", + "event_types": [], + }, + { + "enabled": True, + "hook_type": "pending_message", + "webhook_url": "http://test-url.com", + "timeout_ms": 500, + "callback": { + "mode": "CALLBACK_MODE_REST", + }, + }, + ] ) + client.update_app_settings(event_hooks=[]) + def test_update_user(self, client: StreamChat): user = {"id": str(uuid.uuid4())} response = client.upsert_user(user) From 590f1f13b406c73f8a3c06cece94be8279829fb6 Mon Sep 17 00:00:00 2001 From: Aditya Alif Nugraha Date: Fri, 3 Oct 2025 15:18:40 +0200 Subject: [PATCH 2/8] Fix failing webhook tests --- stream_chat/tests/test_client.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/stream_chat/tests/test_client.py b/stream_chat/tests/test_client.py index a365fc4..2456a3b 100644 --- a/stream_chat/tests/test_client.py +++ b/stream_chat/tests/test_client.py @@ -128,26 +128,22 @@ def test_get_app_settings(self, client: StreamChat): assert "app" in configs def test_update_app_settings(self, client: StreamChat): - # Get current app settings to verify event hooks support response = client.get_app_settings() assert "app" in response client.update_app_settings( event_hooks=[ { - "enabled": True, "hook_type": "webhook", "webhook_url": "https://example.com/webhook", "event_types": ["message.new", "message.updated"], }, { - "enabled": True, "hook_type": "webhook", - "webhook_url": "https://secondary-webhook-url.com", + "webhook_url": "https://google.com", "event_types": [], }, { - "enabled": True, "hook_type": "pending_message", "webhook_url": "http://test-url.com", "timeout_ms": 500, From 6916badf82c402410abb1508275982426e716617 Mon Sep 17 00:00:00 2001 From: Aditya Alif Nugraha Date: Fri, 3 Oct 2025 15:19:40 +0200 Subject: [PATCH 3/8] Fix failing webhook tests --- stream_chat/tests/test_client.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/stream_chat/tests/test_client.py b/stream_chat/tests/test_client.py index 2456a3b..42b80b9 100644 --- a/stream_chat/tests/test_client.py +++ b/stream_chat/tests/test_client.py @@ -128,9 +128,6 @@ def test_get_app_settings(self, client: StreamChat): assert "app" in configs def test_update_app_settings(self, client: StreamChat): - response = client.get_app_settings() - assert "app" in response - client.update_app_settings( event_hooks=[ { From d2258587436f2544fbae3f9b1aafb3467282bf27 Mon Sep 17 00:00:00 2001 From: Aditya Alif Nugraha Date: Fri, 3 Oct 2025 15:25:15 +0200 Subject: [PATCH 4/8] Fix failing webhook tests --- stream_chat/tests/test_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stream_chat/tests/test_client.py b/stream_chat/tests/test_client.py index 42b80b9..c9712f5 100644 --- a/stream_chat/tests/test_client.py +++ b/stream_chat/tests/test_client.py @@ -142,7 +142,7 @@ def test_update_app_settings(self, client: StreamChat): }, { "hook_type": "pending_message", - "webhook_url": "http://test-url.com", + "webhook_url": "http://google.com", "timeout_ms": 500, "callback": { "mode": "CALLBACK_MODE_REST", From 691b8a8ba157a6c5d0d5a48fba585b3c8c3f2433 Mon Sep 17 00:00:00 2001 From: Aditya Alif Nugraha Date: Fri, 3 Oct 2025 17:41:00 +0200 Subject: [PATCH 5/8] Fix blocklist --- stream_chat/tests/async_chat/test_client.py | 2 +- stream_chat/tests/test_client.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stream_chat/tests/async_chat/test_client.py b/stream_chat/tests/async_chat/test_client.py index 4907841..9efec32 100644 --- a/stream_chat/tests/async_chat/test_client.py +++ b/stream_chat/tests/async_chat/test_client.py @@ -726,7 +726,7 @@ async def test_create_blocklist(self, client: StreamChatAsync): async def test_list_blocklists(self, client: StreamChatAsync): response = await client.list_blocklists() - assert len(response["blocklists"]) == 2 + assert len(response["blocklists"]) == 3 blocklist_names = {blocklist["name"] for blocklist in response["blocklists"]} assert "Foo" in blocklist_names diff --git a/stream_chat/tests/test_client.py b/stream_chat/tests/test_client.py index c9712f5..4fce377 100644 --- a/stream_chat/tests/test_client.py +++ b/stream_chat/tests/test_client.py @@ -718,7 +718,7 @@ def test_create_blocklist(self, client: StreamChat): def test_list_blocklists(self, client: StreamChat): response = client.list_blocklists() - assert len(response["blocklists"]) == 2 + assert len(response["blocklists"]) == 3 blocklist_names = {blocklist["name"] for blocklist in response["blocklists"]} assert "Foo" in blocklist_names From 1cb9e5e8bd447e6edf9df7fc4a998bfdcd6cffb7 Mon Sep 17 00:00:00 2001 From: Aditya Alif Nugraha Date: Tue, 7 Oct 2025 10:25:08 +0200 Subject: [PATCH 6/8] Add assertion --- stream_chat/tests/test_client.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/stream_chat/tests/test_client.py b/stream_chat/tests/test_client.py index 4fce377..0aac0bf 100644 --- a/stream_chat/tests/test_client.py +++ b/stream_chat/tests/test_client.py @@ -128,7 +128,7 @@ def test_get_app_settings(self, client: StreamChat): assert "app" in configs def test_update_app_settings(self, client: StreamChat): - client.update_app_settings( + response = client.update_app_settings( event_hooks=[ { "hook_type": "webhook", @@ -150,8 +150,16 @@ def test_update_app_settings(self, client: StreamChat): }, ] ) + assert "app" in response + assert response.is_ok() + assert "event_hooks" in response["app"] + assert len(response["app"]["event_hooks"]) == 3 - client.update_app_settings(event_hooks=[]) + response = client.update_app_settings(event_hooks=[]) + assert "app" in response + assert response.is_ok() + assert "event_hooks" in response["app"] + assert len(response["app"]["event_hooks"]) == 0 def test_update_user(self, client: StreamChat): user = {"id": str(uuid.uuid4())} From e046eb99097c418766012788774878af501cfd0d Mon Sep 17 00:00:00 2001 From: Aditya Alif Nugraha Date: Tue, 7 Oct 2025 10:29:36 +0200 Subject: [PATCH 7/8] Add assertion --- stream_chat/tests/test_client.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/stream_chat/tests/test_client.py b/stream_chat/tests/test_client.py index 0aac0bf..268fe1c 100644 --- a/stream_chat/tests/test_client.py +++ b/stream_chat/tests/test_client.py @@ -150,16 +150,20 @@ def test_update_app_settings(self, client: StreamChat): }, ] ) - assert "app" in response assert response.is_ok() - assert "event_hooks" in response["app"] - assert len(response["app"]["event_hooks"]) == 3 + + settings = client.get_app_settings() + assert "app" in settings + assert "event_hooks" in settings["app"] + assert len(settings["app"]["event_hooks"]) == 3 response = client.update_app_settings(event_hooks=[]) - assert "app" in response assert response.is_ok() - assert "event_hooks" in response["app"] - assert len(response["app"]["event_hooks"]) == 0 + + settings = client.get_app_settings() + assert "app" in settings + assert "event_hooks" in settings["app"] + assert len(settings["app"]["event_hooks"]) == 0 def test_update_user(self, client: StreamChat): user = {"id": str(uuid.uuid4())} From 96b57fb405b758eda09a375a5b9e0770082565b2 Mon Sep 17 00:00:00 2001 From: Aditya Alif Nugraha Date: Tue, 7 Oct 2025 10:33:52 +0200 Subject: [PATCH 8/8] fix lint --- stream_chat/tests/test_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stream_chat/tests/test_client.py b/stream_chat/tests/test_client.py index 268fe1c..ae9c751 100644 --- a/stream_chat/tests/test_client.py +++ b/stream_chat/tests/test_client.py @@ -159,7 +159,7 @@ def test_update_app_settings(self, client: StreamChat): response = client.update_app_settings(event_hooks=[]) assert response.is_ok() - + settings = client.get_app_settings() assert "app" in settings assert "event_hooks" in settings["app"]