1
0
mirror of https://github.com/craigerl/aprsd.git synced 2026-06-07 16:44:39 -04:00

Added unit tests for packets.

Also did some code cleanup.
This commit is contained in:
2026-01-05 16:51:54 -05:00
parent f9979fa3da
commit 1da92e52ef
48 changed files with 1791 additions and 445 deletions
+9 -9
View File
@@ -12,7 +12,7 @@ from aprsd.main import cli
from .. import fake
CONF = cfg.CONF
F = t.TypeVar("F", bound=t.Callable[..., t.Any])
F = t.TypeVar('F', bound=t.Callable[..., t.Any])
class TestSendMessageCommand(unittest.TestCase):
@@ -28,37 +28,37 @@ class TestSendMessageCommand(unittest.TestCase):
# CONF.aprsd_admin_extension.user = "admin"
# CONF.aprsd_admin_extension.password = "password"
@mock.patch("aprsd.log.log.setup_logging")
@mock.patch('aprsd.log.log.setup_logging')
def test_no_tocallsign(self, mock_logging):
"""Make sure we get an error if there is no tocallsign."""
self.config_and_init(
login="something",
password="another",
login='something',
password='another',
)
runner = CliRunner()
result = runner.invoke(
cli,
["send-message"],
['send-message'],
catch_exceptions=False,
)
assert result.exit_code == 2
assert "Error: Missing argument 'TOCALLSIGN'" in result.output
@mock.patch("aprsd.log.log.setup_logging")
@mock.patch('aprsd.log.log.setup_logging')
def test_no_command(self, mock_logging):
"""Make sure we get an error if there is no command."""
self.config_and_init(
login="something",
password="another",
login='something',
password='another',
)
runner = CliRunner()
result = runner.invoke(
cli,
["send-message", "WB4BOR"],
['send-message', 'WB4BOR'],
catch_exceptions=False,
)
assert result.exit_code == 2