Skip to content

Commit

Permalink
Test connection_lost
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly committed Oct 27, 2024
1 parent 18d9eb0 commit c54a1cb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/test_uart.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from unittest.mock import AsyncMock, MagicMock
from unittest.mock import AsyncMock, MagicMock, call

import gpiozero
import pytest
Expand Down Expand Up @@ -52,6 +52,12 @@ def test_close(gw):
assert gw._transport.close.call_count == 1


def test_connection_lost(gw):
exc = RuntimeError()
gw.connection_lost(exc)
assert gw._api.connection_lost.mock_calls == [call(exc)]


def test_data_received_chunk_frame(gw):
data = b"\x01\x80\x10\x02\x10\x02\x15\xaa\x02\x10\x02\x1f?\xf0\xff\x03"
gw.data_received(data[:-4])
Expand Down

0 comments on commit c54a1cb

Please sign in to comment.