Add coverage to ensure pairing ignores responses from the wrong device (#748)

This commit is contained in:
J. Nick Koston 2023-11-26 17:17:22 -06:00 committed by GitHub
parent 98c6e6a2ae
commit a8e2e6828b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -907,6 +907,10 @@ async def test_bluetooth_pair(
client, connection, transport, protocol = api_client
pair_task = asyncio.create_task(client.bluetooth_device_pair(1234))
await asyncio.sleep(0)
response: message.Message = BluetoothDevicePairingResponse(address=4567)
mock_data_received(protocol, generate_plaintext_packet(response))
await asyncio.sleep(0)
assert not pair_task.done()
response: message.Message = BluetoothDevicePairingResponse(address=1234)
mock_data_received(protocol, generate_plaintext_packet(response))
await pair_task