From 63b3f4dfe22aad10f81027c13cda8a78d5e48b80 Mon Sep 17 00:00:00 2001 From: Goffi Date: Mon, 14 Sep 2026 13:55:57 +0200 Subject: [PATCH] tests (xep_0272): assert the group setup call in the preparation test --- tests/unit/test_plugin_xep_0272.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/unit/test_plugin_xep_0272.py b/tests/unit/test_plugin_xep_0272.py index 411d5101..52fd389f 100644 --- a/tests/unit/test_plugin_xep_0272.py +++ b/tests/unit/test_plugin_xep_0272.py @@ -102,14 +102,20 @@ class TestXEP0272: mock_try_to_finish_preparation.assert_not_called() def test_try_to_finish_preparation(self, host, client): - """try_to_finish_preparation sets done_preparing to True.""" + """try_to_finish_preparation sets done_preparing to True and emits the signal.""" xep_0272 = XEP_0272(host) room = MagicMock() muji_data = {"preparing_jids": set(), "to_call": set()} - with patch.object(xep_0272, "get_muji_data", return_value=muji_data): + # signals are synchronous (see _Bridge.send_signal): use a plain mock, not the + # async one of the bridge fixture + with ( + patch.object(xep_0272, "get_muji_data", return_value=muji_data), + patch.object(host.bridge, "call_group_setup") as mock_call_group_setup, + ): xep_0272.try_to_finish_preparation(client, room, muji_data) assert muji_data["done_preparing"] is True + mock_call_group_setup.assert_called_once() @ed async def test_call_group_data_set(self, host, client):