From 9d01dde9e4525ac1b73f8d849012516916746497 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Mon, 30 Jun 2025 14:43:48 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA(backend)=20fix=20unreachable=20ass?= =?UTF-8?q?ertion=20after=20expected=20exception?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove assertion statement that was placed after code expected to raise an exception. The assertion was never evaluated due to the exception flow, making the test ineffective. --- src/backend/core/tests/rooms/test_api_rooms_invite.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/backend/core/tests/rooms/test_api_rooms_invite.py b/src/backend/core/tests/rooms/test_api_rooms_invite.py index 1a9c73ea..3616b55b 100644 --- a/src/backend/core/tests/rooms/test_api_rooms_invite.py +++ b/src/backend/core/tests/rooms/test_api_rooms_invite.py @@ -230,15 +230,14 @@ def test_api_rooms_invite_error(mock_invite_to_room): data = {"emails": ["toto@yopmail.com", "toto@yopmail.com"]} - with pytest.raises(InvitationError) as excinfo: + with pytest.raises(InvitationError): client.post( f"/api/v1.0/rooms/{room.id}/invite/", json.dumps(data), content_type="application/json", ) - mock_invite_to_room.assert_called_once() - assert "Could not send invitation" in str(excinfo.value) + mock_invite_to_room.assert_called_once() @mock.patch("core.services.invitation.send_mail")