def stage(self, mocker, request, cls_type, init_kwargs): mock_transport = mocker.patch( "azure.iot.device.common.pipeline.pipeline_stages_http.HTTPTransport", autospec=True) stage = cls_type(**init_kwargs) stage.send_op_down = mocker.MagicMock() # Set up the Transport on the stage if request.param == "SAS": op = pipeline_ops_http.SetHTTPConnectionArgsOperation( hostname="fake_hostname", ca_cert="fake_ca_cert", sas_token="fake_sas_token", callback=mocker.MagicMock(), ) else: op = pipeline_ops_http.SetHTTPConnectionArgsOperation( hostname="fake_hostname", ca_cert="fake_ca_cert", client_cert="fake_client_cert", callback=mocker.MagicMock(), ) stage.run_op(op) assert stage.transport is mock_transport.return_value return stage
def op(self, mocker): return pipeline_ops_http.SetHTTPConnectionArgsOperation( hostname="fake_hostname", ca_cert="fake_ca_cert", client_cert="fake_client_cert", sas_token="fake_sas_token", callback=mocker.MagicMock(), )