From 701b731a5e2e39d434366bbfdcf13ee655b5670e Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Mon, 12 Oct 2026 09:26:43 +0200 Subject: [PATCH] Fix sonarqqqqqqube error --- server/tests/unit/test_protocol.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/tests/unit/test_protocol.py b/server/tests/unit/test_protocol.py index ba43fb38..d503bb66 100644 --- a/server/tests/unit/test_protocol.py +++ b/server/tests/unit/test_protocol.py @@ -18,8 +18,9 @@ def test_encode_ping(): def test_decode_header_rejects_bad_protocol_id(): + body = struct.pack(">HHI", 0, messages.AddRecord.msg_id, 8) with pytest.raises(messages.ProtocolError): - messages.Header.decode(struct.pack(">HHI", 0, messages.AddRecord.msg_id, 8)) + messages.Header.decode(body) def test_decode_header_rejects_partial_header(): @@ -34,8 +35,9 @@ def test_decode_client_greeting(): def test_decode_pong_requires_exact_length(): + body = struct.pack(">II", 1, 2) with pytest.raises(messages.ProtocolError): - messages.Pong.decode(struct.pack(">II", 1, 2)) + messages.Pong.decode(body) def test_decode_add_record():