def mock_provisioning_pipeline(mocker, input_security_client,
                               mock_mqtt_transport):
    provisioning_pipeline = ProvisioningPipeline(input_security_client)
    provisioning_pipeline.on_connected = mocker.MagicMock()
    provisioning_pipeline.on_disconnected = mocker.MagicMock()
    provisioning_pipeline.on_message_received = mocker.MagicMock()
    helpers.add_mock_method_waiter(provisioning_pipeline, "on_connected")
    helpers.add_mock_method_waiter(provisioning_pipeline, "on_disconnected")
    helpers.add_mock_method_waiter(mock_mqtt_transport, "publish")

    yield provisioning_pipeline
    provisioning_pipeline.disconnect()
def mock_provisioning_pipeline(params_security_clients):
    input_security_client = params_security_clients["client_class"](
        **params_security_clients["init_kwargs"])
    with patch(
            "azure.iot.device.provisioning.pipeline.provisioning_pipeline.pipeline_stages_mqtt.MQTTTransport"
    ):
        provisioning_pipeline = ProvisioningPipeline(input_security_client)
    provisioning_pipeline.on_connected = MagicMock()
    provisioning_pipeline.on_disconnected = MagicMock()
    provisioning_pipeline.on_message_received = MagicMock()
    helpers.add_mock_method_waiter(provisioning_pipeline, "on_connected")
    helpers.add_mock_method_waiter(provisioning_pipeline, "on_disconnected")
    helpers.add_mock_method_waiter(provisioning_pipeline._pipeline.transport,
                                   "publish")

    yield provisioning_pipeline
    provisioning_pipeline.disconnect()
Пример #3
0
 def op(self, op_cls, callback):
     op = make_mock_op_or_event(op_cls)
     op.callback = callback
     op.action = "pend"
     add_mock_method_waiter(op, "callback")
     return op
 def op(self, request, mocker):
     op = make_mock_op_or_event(request.param)
     op.callback = mocker.MagicMock()
     add_mock_method_waiter(op, "callback")
     return op
Пример #5
0
 def op(self, op_cls, mocker):
     op = make_mock_op_or_event(op_cls)
     op.callback = mocker.MagicMock()
     add_mock_method_waiter(op, "callback")
     return op