@@ -2713,24 +2713,6 @@ def test_remove_ignored_node():
27132713 main ()
27142714
27152715 mocked_node .removeIgnored .assert_called_once_with ("!12345678" )
2716-
2717- @pytest .mark .unit
2718- @pytest .mark .usefixtures ("reset_mt_config" )
2719- def test_main_set_owner_short_to_bob (capsys ):
2720- """Test --set-owner-short bob"""
2721- sys .argv = ["" , "--set-owner-short" , "bob" ]
2722- mt_config .args = sys .argv
2723-
2724- iface = MagicMock (autospec = SerialInterface )
2725- with patch ("meshtastic.serial_interface.SerialInterface" , return_value = iface ) as mo :
2726- main ()
2727- out , err = capsys .readouterr ()
2728- assert re .search (r"Connected to radio" , out , re .MULTILINE )
2729- assert re .search (r"Setting device owner short to bob" , out , re .MULTILINE )
2730- assert err == ""
2731- mo .assert_called ()
2732-
2733-
27342716@pytest .mark .unit
27352717@pytest .mark .usefixtures ("reset_mt_config" )
27362718def test_main_set_owner_whitespace_only (capsys ):
@@ -2740,8 +2722,8 @@ def test_main_set_owner_whitespace_only(capsys):
27402722
27412723 with pytest .raises (SystemExit ) as excinfo :
27422724 main ()
2743-
2744- out , err = capsys .readouterr ()
2725+
2726+ out , _ = capsys .readouterr ()
27452727 assert "ERROR: Long Name cannot be empty or contain only whitespace characters" in out
27462728 assert excinfo .value .code == 1
27472729
@@ -2755,8 +2737,8 @@ def test_main_set_owner_empty_string(capsys):
27552737
27562738 with pytest .raises (SystemExit ) as excinfo :
27572739 main ()
2758-
2759- out , err = capsys .readouterr ()
2740+
2741+ out , _ = capsys .readouterr ()
27602742 assert "ERROR: Long Name cannot be empty or contain only whitespace characters" in out
27612743 assert excinfo .value .code == 1
27622744
@@ -2770,8 +2752,8 @@ def test_main_set_owner_short_whitespace_only(capsys):
27702752
27712753 with pytest .raises (SystemExit ) as excinfo :
27722754 main ()
2773-
2774- out , err = capsys .readouterr ()
2755+
2756+ out , _ = capsys .readouterr ()
27752757 assert "ERROR: Short Name cannot be empty or contain only whitespace characters" in out
27762758 assert excinfo .value .code == 1
27772759
@@ -2785,7 +2767,37 @@ def test_main_set_owner_short_empty_string(capsys):
27852767
27862768 with pytest .raises (SystemExit ) as excinfo :
27872769 main ()
2788-
2789- out , err = capsys .readouterr ()
2770+
2771+ out , _ = capsys .readouterr ()
27902772 assert "ERROR: Short Name cannot be empty or contain only whitespace characters" in out
27912773 assert excinfo .value .code == 1
2774+
2775+
2776+ @pytest .mark .unit
2777+ @pytest .mark .usefixtures ("reset_mt_config" )
2778+ def test_main_set_ham_whitespace_only (capsys ):
2779+ """Test --set-ham with whitespace-only name"""
2780+ sys .argv = ["" , "--set-ham" , " " ]
2781+ mt_config .args = sys .argv
2782+
2783+ with pytest .raises (SystemExit ) as excinfo :
2784+ main ()
2785+
2786+ out , _ = capsys .readouterr ()
2787+ assert "ERROR: Ham radio callsign cannot be empty or contain only whitespace characters" in out
2788+ assert excinfo .value .code == 1
2789+
2790+
2791+ @pytest .mark .unit
2792+ @pytest .mark .usefixtures ("reset_mt_config" )
2793+ def test_main_set_ham_empty_string (capsys ):
2794+ """Test --set-ham with empty string"""
2795+ sys .argv = ["" , "--set-ham" , "" ]
2796+ mt_config .args = sys .argv
2797+
2798+ with pytest .raises (SystemExit ) as excinfo :
2799+ main ()
2800+
2801+ out , _ = capsys .readouterr ()
2802+ assert "ERROR: Ham radio callsign cannot be empty or contain only whitespace characters" in out
2803+ assert excinfo .value .code == 1
0 commit comments