@@ -454,6 +454,37 @@ def test_main_set_owner_short_to_bob(capsys):
454454 assert err == ""
455455 mo .assert_called ()
456456
457+ @pytest .mark .unit
458+ @pytest .mark .usefixtures ("reset_mt_config" )
459+ def test_main_set_is_unmessageable_to_true (capsys ):
460+ """Test --set-is-unmessageable true"""
461+ sys .argv = ["" , "--set-is-unmessageable" , "true" ]
462+ mt_config .args = sys .argv
463+
464+ iface = MagicMock (autospec = SerialInterface )
465+ with patch ("meshtastic.serial_interface.SerialInterface" , return_value = iface ) as mo :
466+ main ()
467+ out , err = capsys .readouterr ()
468+ assert re .search (r"Connected to radio" , out , re .MULTILINE )
469+ assert re .search (r"Setting is_unmessagable to true" , out , re .MULTILINE )
470+ assert err == ""
471+ mo .assert_called ()
472+
473+ @pytest .mark .unit
474+ @pytest .mark .usefixtures ("reset_mt_config" )
475+ def test_main_set_is_unmessagable_to_true (capsys ):
476+ """Test --set-is-unmessagable true"""
477+ sys .argv = ["" , "--set-is-unmessagable" , "true" ]
478+ mt_config .args = sys .argv
479+
480+ iface = MagicMock (autospec = SerialInterface )
481+ with patch ("meshtastic.serial_interface.SerialInterface" , return_value = iface ) as mo :
482+ main ()
483+ out , err = capsys .readouterr ()
484+ assert re .search (r"Connected to radio" , out , re .MULTILINE )
485+ assert re .search (r"Setting is_unmessagable to true" , out , re .MULTILINE )
486+ assert err == ""
487+ mo .assert_called ()
457488
458489@pytest .mark .unit
459490@pytest .mark .usefixtures ("reset_mt_config" )
0 commit comments