@@ -724,12 +724,41 @@ def test_main_sendtext_with_dest(mock_findPorts, mock_serial, mocked_open, mock_
724724 assert re .search (r"Warning: There were no self.nodes." , caplog .text , re .MULTILINE )
725725 assert err == ""
726726
727+ @pytest .mark .unit
728+ @pytest .mark .usefixtures ("reset_mt_config" )
729+ def test_main_removeposition_invalid (capsys ):
730+ """Test --remove-position with an invalid dest"""
731+ sys .argv = ["" , "--remove-position" , "--dest" , "!12345678" ]
732+ mt_config .args = sys .argv
733+ iface = MagicMock (autospec = SerialInterface )
734+ with patch ("meshtastic.serial_interface.SerialInterface" , return_value = iface ) as mo :
735+ main ()
736+ out , err = capsys .readouterr ()
737+ assert re .search (r"Connected to radio" , out , re .MULTILINE )
738+ assert re .search (r"remote nodes is not supported" , out , re .MULTILINE )
739+ assert err == ""
740+ mo .assert_called ()
741+
742+ @pytest .mark .unit
743+ @pytest .mark .usefixtures ("reset_mt_config" )
744+ def test_main_setlat_invalid (capsys ):
745+ """Test --setlat with an invalid dest"""
746+ sys .argv = ["" , "--setlat" , "37.5" , "--dest" , "!12345678" ]
747+ mt_config .args = sys .argv
748+ iface = MagicMock (autospec = SerialInterface )
749+ with patch ("meshtastic.serial_interface.SerialInterface" , return_value = iface ) as mo :
750+ main ()
751+ out , err = capsys .readouterr ()
752+ assert re .search (r"Connected to radio" , out , re .MULTILINE )
753+ assert re .search (r"remote nodes is not supported" , out , re .MULTILINE )
754+ assert err == ""
755+ mo .assert_called ()
756+
727757@pytest .mark .unit
728758@pytest .mark .usefixtures ("reset_mt_config" )
729759def test_main_removeposition (capsys ):
730760 """Test --remove-position"""
731761 sys .argv = ["" , "--remove-position" ]
732-
733762 mt_config .args = sys .argv
734763
735764 mocked_node = MagicMock (autospec = Node )
0 commit comments