- Overview
- MockEvents
MockEvents
Part of Offline testing in the Python API reference.
Related guidance: getting-started/mock-setup.
Runnable examples: preflight.py.
from picogrid_ecn_client.testing import MockEventsExpose synchronization events for deterministic asynchronous tests.
class MockEvents: ...mqtt_connected
Section titled “mqtt_connected”Set when an MQTT v5 client connection is accepted.
mqtt_connected: asyncio.Eventmqtt_disconnected
Section titled “mqtt_disconnected”Set when an accepted MQTT v5 client disconnects.
mqtt_disconnected: asyncio.Eventmessage_received
Section titled “message_received”Set when the mock receives a client publication.
message_received: asyncio.Eventmessage_forwarded
Section titled “message_forwarded”Set when the mock forwards a publication to subscribed clients.
message_forwarded: asyncio.Eventmessage_dropped
Section titled “message_dropped”Set when a configured drop suppresses publication forwarding.
message_dropped: asyncio.Eventmalformed_message_sent
Section titled “malformed_message_sent”Set when a configured malformed payload is forwarded.
malformed_message_sent: asyncio.Eventauthentication_failed
Section titled “authentication_failed”Set when synthetic authentication rejects a client.
authentication_failed: asyncio.Eventauthorization_denied
Section titled “authorization_denied”Set when a synthetic mock-only ACL label denies an operation.
authorization_denied: asyncio.Eventforced_disconnect
Section titled “forced_disconnect”Set when deterministic forced disconnection is requested.
forced_disconnect: asyncio.Eventconnection_dropped
Section titled “connection_dropped”Set when a transient connection drop consumes one configured attempt.
connection_dropped: asyncio.Eventacknowledgement_denied
Section titled “acknowledgement_denied”Set when an operation-specific negative acknowledgment is returned.
acknowledgement_denied: asyncio.Eventacknowledgement_reason_returned
Section titled “acknowledgement_reason_returned”Set when one configured raw MQTT reason code is returned.
acknowledgement_reason_returned: asyncio.Eventmalformed_protocol_response
Section titled “malformed_protocol_response”Set when the mock sends one deliberately malformed MQTT response.
malformed_protocol_response: asyncio.Eventpublication_disconnected_before_send
Section titled “publication_disconnected_before_send”Set when clients are disconnected before a caller starts publication.
publication_disconnected_before_send: asyncio.Eventpublication_disconnected_qos0_before_completion
Section titled “publication_disconnected_qos0_before_completion”Set when a QoS 0 PUBLISH is interrupted after its fixed header.
publication_disconnected_qos0_before_completion: asyncio.Eventpublication_disconnected_before_puback
Section titled “publication_disconnected_before_puback”Set when a processed QoS 1 publication is disconnected before PUBACK.
publication_disconnected_before_puback: asyncio.Eventpublication_disconnected_after_puback
Section titled “publication_disconnected_after_puback”Set when a QoS 1 publisher is disconnected immediately after PUBACK.
publication_disconnected_after_puback: asyncio.EventClear every synchronization event without replacing event objects.
def reset() -> NoneVersion 0.2.0 · branch main
