From e85f041e9dba7e6379ee3604a3bb006975e49c88 Mon Sep 17 00:00:00 2001 From: Markus Jellitsch Date: Fri, 3 Apr 2026 23:04:48 +0200 Subject: [PATCH] add test for smp debug mode --- tests/smp_test.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/smp_test.py b/tests/smp_test.py index f48c309..942fac0 100644 --- a/tests/smp_test.py +++ b/tests/smp_test.py @@ -24,7 +24,7 @@ import pytest from bumble import crypto, pairing, smp from bumble.core import AdvertisingData from bumble.crypto import EccKey, aes_cmac, ah, c1, f4, f5, f6, g2, h6, h7, s1 -from bumble.device import Device +from bumble.device import Device, DeviceConfiguration from bumble.hci import Address from bumble.pairing import LeRole, OobData, OobSharedData @@ -312,3 +312,18 @@ async def test_send_identity_address_command( actual_command = mock_method.call_args.args[0] assert actual_command.addr_type == expected_identity_address.address_type assert actual_command.bd_addr == expected_identity_address + + +@pytest.mark.asyncio +async def test_smp_debug_mode(): + config = DeviceConfiguration(smp_debug_mode=True) + device = Device(config=config) + + # assert device.smp_manager.ecc_key.private_key == smp.SMP_DEBUG_KEY_PRIVATE + assert device.smp_manager.ecc_key.x == smp.SMP_DEBUG_KEY_PUBLIC_X + assert device.smp_manager.ecc_key.y == smp.SMP_DEBUG_KEY_PUBLIC_Y + + device.smp_manager.debug_mode = False + + assert not device.smp_manager.ecc_key.x == smp.SMP_DEBUG_KEY_PUBLIC_X + assert not device.smp_manager.ecc_key.y == smp.SMP_DEBUG_KEY_PUBLIC_Y