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

Commit 98f53bd3 authored by Martin Brabham's avatar Martin Brabham
Browse files

HciMatchers: enforce argument requirement

If the command complete opcode is not specified then it
will match ANY command complete event which can prove to
be troubles some when getting a series of CommandComplete()
matches.

Bug: 162984360
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Change-Id: Ia42c74c6476fd9d0763afa87ad1f61a243942e27
parent 9d59ea8e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ from bluetooth_packets_python3.l2cap_packets import LeCreditBasedConnectionRespo
class HciMatchers(object):

    @staticmethod
    def CommandComplete(opcode=None):
    def CommandComplete(opcode):
        return lambda msg: HciMatchers._is_matching_command_complete(msg.payload, opcode)

    @staticmethod
+2 −1
Original line number Diff line number Diff line
@@ -265,7 +265,8 @@ class CertSecurity(PySecurity):
        self._enqueue_hci_command(
            hci_packets.IoCapabilityRequestReplyBuilder(
                dut_address.decode('utf8'), self._io_caps, oob_data_present, self._auth_reqs), True)
        assertThat(self._hci_event_stream).emits(HciMatchers.CommandComplete())
        assertThat(self._hci_event_stream).emits(
            HciMatchers.CommandComplete(hci_packets.OpCode.IO_CAPABILITY_REQUEST_REPLY))
        logging.info("Cert: Waiting for SIMPLE_PAIRING_COMPLETE")
        ssp_complete_capture = HciCaptures.SimplePairingCompleteCapture()
        assertThat(self._hci_event_stream).emits(ssp_complete_capture)