From 0b75b615757ddef01ec976071e4ff122bce6bee2 Mon Sep 17 00:00:00 2001 From: ABuljko Date: Mon, 26 Oct 2026 08:32:41 +0100 Subject: [PATCH] Let a request sent again during an answer be answered --- chat_client/app.py | 1 + tests/test_client.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/chat_client/app.py b/chat_client/app.py index 6ce8ad2..b2d3f26 100644 --- a/chat_client/app.py +++ b/chat_client/app.py @@ -345,6 +345,7 @@ def on_pending(self, message): def on_request_received(self, message): username = message["username"] + self.answering.discard(username) if username not in self.pending: self.pending.append(username) self.view.set_pending(self.pending) diff --git a/tests/test_client.py b/tests/test_client.py index bfb1314..e45e8a6 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -278,6 +278,18 @@ def test_double_click_answers_once(app, connector): assert answers(new) == [("dave", False)] +def test_request_sent_again_during_answer_can_be_answered(app, connector): + conn = log_in(app, connector, friends=()) + conn.receive("pending", users=["carol"]) + app.process_events() + app.respond_request("carol", False) + conn.receive("request_received", username="carol") + conn.receive("pending", users=["carol"]) + app.process_events() + app.respond_request("carol", True) + assert answers(conn) == [("carol", False), ("carol", True)] + + def test_guest_commands_need_login(app): app.find_user() app.open_pending()