From d72cc0e201fc065923cea86edce906a22dcc5f60 Mon Sep 17 00:00:00 2001 From: Nerdenator Date: Tue, 4 Jun 2024 01:01:32 -0500 Subject: [PATCH] quick-coverage: simple test case just to cover uncovered code. --- meshtastic/tests/test_util.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/meshtastic/tests/test_util.py b/meshtastic/tests/test_util.py index 8209487..dc713bf 100644 --- a/meshtastic/tests/test_util.py +++ b/meshtastic/tests/test_util.py @@ -33,6 +33,7 @@ from meshtastic.util import ( stripnl, support_info, message_to_json, + Acknowledgment ) @@ -555,3 +556,24 @@ def test_message_to_json_shows_all(): actual = json.loads(message_to_json(MyNodeInfo())) expected = { "myNodeNum": 0, "rebootCount": 0, "minAppVersion": 0 } assert actual == expected + +@pytest.mark.unit +def test_acknowledgement_reset(): + """ + Test that the reset method can set all fields back to False + """ + test_ack_obj = Acknowledgment() + # everything's set to False; let's set it to True to get a good test + test_ack_obj.receivedAck = True + test_ack_obj.receivedNak = True + test_ack_obj.receivedImplAck = True + test_ack_obj.receivedTraceRoute = True + test_ack_obj.receivedTelemetry = True + test_ack_obj.receivedPosition = True + test_ack_obj.reset() + assert test_ack_obj.receivedAck == False + assert test_ack_obj.receivedNak == False + assert test_ack_obj.receivedImplAck == False + assert test_ack_obj.receivedTraceRoute == False + assert test_ack_obj.receivedTelemetry == False + assert test_ack_obj.receivedPosition == False