Exemplo n.º 1
0
 def _prepare_request(self, method="POST", headers=None, form_data=None, params=None):
     # type: (Optional[str], Optional[Mapping[str, str]], Optional[Mapping[str, str]], Optional[Dict[str, str]]) -> HttpRequest
     request = HttpRequest(method, self._auth_url, headers=headers)
     if form_data:
         request.headers["Content-Type"] = "application/x-www-form-urlencoded"
         request.set_formdata_body(form_data)
     if params:
         request.format_parameters(params)
     return request
Exemplo n.º 2
0
    def __init__(self, policies=None, assert_current_span=False):
        time.sleep(0.001)
        self.request = HttpRequest("GET", "https://bing.com")
        if policies is None:
            policies = []
        policies.append(mock.Mock(spec=HTTPPolicy, send=self.verify_request))
        self.policies = policies
        self.transport = mock.Mock(spec=HttpTransport)
        self.pipeline = Pipeline(self.transport, policies=policies)

        self.expected_response = mock.Mock(spec=PipelineResponse)
        self.assert_current_span = assert_current_span