def token_post(self, url, payload, headers={}, **kwargs): """Mock the request for an OAuth token. """ self.access_token_requests.append((url, payload, headers, kwargs)) response = self.access_token_response return HTTP._process_response(url, response, **kwargs)
def _request_with_timeout(self, method, url, *args, **kwargs): self.requests.append([method, url, args, kwargs]) response = self.responses.pop() return HTTP._process_response( url, response, kwargs.get('allowed_response_codes'), kwargs.get('disallowed_response_codes') )
def _make_request(self, url, *args, **kwargs): response = self.responses.pop() self.requests.append((url, args, kwargs)) return HTTP._process_response( url, response, kwargs.get('allowed_response_codes'), kwargs.get('disallowed_response_codes') )
def _request(self, method, url, headers, data, params, **kwargs): """Override EnkiAPI._request to pull responses from a queue instead of making real HTTP requests """ self.requests.append([method, url, headers, data, params, kwargs]) response = self.responses.pop() return HTTP._process_response( url, response, kwargs.get('allowed_response_codes'), kwargs.get('disallowed_response_codes'), )
def _get(self, url, headers=None): self.requests.append([url, headers]) response = self.responses.pop() return HTTP._process_response(url, response)