11"""Meshtastic unit tests for showNodes favorite column feature"""
22
3+ from unittest .mock import MagicMock
4+
35import pytest
46
57from ..mesh_interface import MeshInterface
68
79
810@pytest .fixture
9- def iface_with_favorite_nodes ():
11+ def _iface_with_favorite_nodes ():
1012 """Fixture to setup nodes with favorite flags."""
1113 nodesById = {
1214 "!9388f81c" : {
@@ -69,27 +71,26 @@ def iface_with_favorite_nodes():
6971 iface = MeshInterface (noProto = True )
7072 iface .nodes = nodesById
7173 iface .nodesByNum = nodesByNum
72- from unittest .mock import MagicMock
7374 myInfo = MagicMock ()
7475 iface .myInfo = myInfo
7576 iface .myInfo .my_node_num = 2475227164
7677 return iface
7778
7879
7980@pytest .mark .unit
80- def test_showNodes_favorite_column_header (capsys , iface_with_favorite_nodes ):
81+ def test_showNodes_favorite_column_header (capsys , _iface_with_favorite_nodes ):
8182 """Test that 'Fav' column header appears in showNodes output"""
82- iface = iface_with_favorite_nodes
83+ iface = _iface_with_favorite_nodes
8384 iface .showNodes ()
8485 out , err = capsys .readouterr ()
8586 assert "Fav" in out
8687 assert err == ""
8788
8889
8990@pytest .mark .unit
90- def test_showNodes_favorite_asterisk_display (capsys , iface_with_favorite_nodes ):
91+ def test_showNodes_favorite_asterisk_display (capsys , _iface_with_favorite_nodes ):
9192 """Test that favorite nodes show asterisk and non-favorites show empty"""
92- iface = iface_with_favorite_nodes
93+ iface = _iface_with_favorite_nodes
9394 iface .showNodes ()
9495 out , err = capsys .readouterr ()
9596
@@ -135,9 +136,9 @@ def test_showNodes_favorite_field_formatting():
135136
136137
137138@pytest .mark .unit
138- def test_showNodes_with_custom_fields_including_favorite (capsys , iface_with_favorite_nodes ):
139+ def test_showNodes_with_custom_fields_including_favorite (capsys , _iface_with_favorite_nodes ):
139140 """Test that isFavorite can be specified in custom showFields"""
140- iface = iface_with_favorite_nodes
141+ iface = _iface_with_favorite_nodes
141142 custom_fields = ["user.longName" , "isFavorite" ]
142143 iface .showNodes (showFields = custom_fields )
143144 out , err = capsys .readouterr ()
@@ -148,13 +149,12 @@ def test_showNodes_with_custom_fields_including_favorite(capsys, iface_with_favo
148149
149150
150151@pytest .mark .unit
151- def test_showNodes_default_fields_includes_favorite (iface_with_favorite_nodes ):
152+ def test_showNodes_default_fields_includes_favorite (_iface_with_favorite_nodes ):
152153 """Test that isFavorite is included in default fields"""
153- iface = iface_with_favorite_nodes
154+ iface = _iface_with_favorite_nodes
154155
155156 # Call showNodes which uses default fields
156157 result = iface .showNodes ()
157158
158159 # The result should contain the formatted table as a string
159160 assert "Fav" in result
160-
0 commit comments