Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8573339 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Pass AddressWithType into messages correctly

BluetoothAddress is created from string, which was improperly set to
both address and type up till now. After this is fixed, one can finally
compare address with expected address in events.

Tag: #gd-refactor
Bug: 155399771
Test: gd/cert/run --host LeSecurityTest
Change-Id: I06d14f9eec6ac457d6f232899a4b9a63879ce7c1
parent 3c19d92f
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -592,13 +592,13 @@ class L2capMatchers(object):
class SecurityMatchers(object):

    @staticmethod
    def UiMsg(type):
        return lambda event: True if event.message_type == type else False
    def UiMsg(type, address=None):
        return lambda event: True if event.message_type == type and (address == None or address == event.peer) else False

    @staticmethod
    def BondMsg(type):
        return lambda event: True if event.message_type == type else False
    def BondMsg(type, address=None):
        return lambda event: True if event.message_type == type and (address == None or address == event.peer) else False

    @staticmethod
    def HelperMsg(type):
        return lambda event: True if event.message_type == type else False
    def HelperMsg(type, address=None):
        return lambda event: True if event.message_type == type and (address == None or address == event.peer) else False
+2 −1
Original line number Diff line number Diff line
@@ -65,7 +65,8 @@ class PyLeSecurity(Closable):
        return display_passkey_capture.get()

    def wait_device_disconnect(self, address):
        assertThat(self._helper_event_stream).emits(SecurityMatchers.HelperMsg(HelperMsgType.DEVICE_DISCONNECTED))
        assertThat(self._helper_event_stream).emits(
            SecurityMatchers.HelperMsg(HelperMsgType.DEVICE_DISCONNECTED, address))

    def SetLeAuthRequirements(self, *args, **kwargs):
        return self._device.security.SetLeAuthRequirements(LeAuthRequirementsMessage(*args, **kwargs))