1
0
mirror of https://github.com/craigerl/aprsd.git synced 2026-08-15 08:04:19 -04:00

make consumer call signature consistent.

This commit is contained in:
2026-02-18 14:11:25 -05:00
parent 2b7e42802b
commit 6ea9889369
6 changed files with 87 additions and 14 deletions
+7 -3
View File
@@ -175,11 +175,15 @@ class TestKISSDriver(unittest.TestCase):
self.driver._connected = True
callback = mock.MagicMock()
mock_frame = b'test_frame'
mock_packet = mock.MagicMock()
with mock.patch.object(self.driver, 'read_frame', return_value=mock_frame):
with mock.patch('aprsd.client.drivers.kiss_common.LOG'):
self.driver.consumer(callback)
callback.assert_called()
with mock.patch.object(
self.driver, 'decode_packet', return_value=mock_packet
):
with mock.patch('aprsd.client.drivers.kiss_common.LOG'):
self.driver.consumer(callback)
callback.assert_called_once_with(packet=mock_packet)
def test_read_frame_not_implemented(self):
"""Test read_frame() raises NotImplementedError."""
+7 -3
View File
@@ -373,6 +373,7 @@ class TestTCPKISSDriver(unittest.TestCase):
"""Test consumer processes frames and calls callback."""
mock_callback = mock.MagicMock()
mock_frame = mock.MagicMock()
mock_packet = mock.MagicMock()
# Configure driver for test
self.driver._connected = True
@@ -386,10 +387,13 @@ class TestTCPKISSDriver(unittest.TestCase):
with mock.patch.object(
self.driver, 'read_frame', side_effect=side_effect
) as mock_read_frame:
self.driver.consumer(mock_callback)
with mock.patch.object(
self.driver, 'decode_packet', return_value=mock_packet
):
self.driver.consumer(mock_callback)
mock_read_frame.assert_called_once()
mock_callback.assert_called_once_with(mock_frame)
mock_read_frame.assert_called_once()
mock_callback.assert_called_once_with(packet=mock_packet)
@mock.patch('aprsd.client.drivers.tcpkiss.LOG')
def test_read_frame_success(self, mock_log):