Beispiel #1
0
    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')
     )
Beispiel #3
0
 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_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')
     )
Beispiel #5
0
 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'),
     )
Beispiel #6
0
 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'),
     )
Beispiel #7
0
 def _get(self, url, headers=None):
     self.requests.append([url, headers])
     response = self.responses.pop()
     return HTTP._process_response(url, response)