From d72cc0e201fc065923cea86edce906a22dcc5f60 Mon Sep 17 00:00:00 2001 From: Nerdenator Date: Tue, 4 Jun 2024 01:01:32 -0500 Subject: [PATCH 1/2] 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 From 87a4bb0888155e6d649f7d8e8a8ce08fa09ba863 Mon Sep 17 00:00:00 2001 From: Nerdenator Date: Tue, 4 Jun 2024 01:15:10 -0500 Subject: [PATCH 2/2] quick-coverage: fixing linting issues. --- meshtastic/tests/test_util.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/meshtastic/tests/test_util.py b/meshtastic/tests/test_util.py index dc713bf..32ca3db 100644 --- a/meshtastic/tests/test_util.py +++ b/meshtastic/tests/test_util.py @@ -571,9 +571,9 @@ def test_acknowledgement_reset(): 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 + assert test_ack_obj.receivedAck is False + assert test_ack_obj.receivedNak is False + assert test_ack_obj.receivedImplAck is False + assert test_ack_obj.receivedTraceRoute is False + assert test_ack_obj.receivedTelemetry is False + assert test_ack_obj.receivedPosition is False