diff --git a/tests/gatt_test.py b/tests/gatt_test.py index f783cae9..8d73eb3f 100644 --- a/tests/gatt_test.py +++ b/tests/gatt_test.py @@ -851,7 +851,12 @@ async def test_unsubscribe(): await async_barrier() mock1.assert_called_once_with(ANY, True, False) - await c2.subscribe() + assert len(server.gatt_server.subscribers) == 1 + + def callback(_): + pass + + await c2.subscribe(callback) await async_barrier() mock2.assert_called_once_with(ANY, True, False) @@ -861,10 +866,16 @@ async def test_unsubscribe(): mock1.assert_called_once_with(ANY, False, False) mock2.reset_mock() - await c2.unsubscribe() + await c2.unsubscribe(callback) await async_barrier() mock2.assert_called_once_with(ANY, False, False) + # All CCCDs should be zeros now + assert list(server.gatt_server.subscribers.values())[0] == { + c1.handle: bytes([0, 0]), + c2.handle: bytes([0, 0]), + } + mock1.reset_mock() await c1.unsubscribe() await async_barrier()