API¶
Caching Request Data¶
-
faux.client.
get
(*args, **kwargs)¶ Sends a GET request.
Parameters: - url – URL for the new
Request
object. - params – (optional) Dictionary, list of tuples or bytes to send
in the query string for the
Request
. - **kwargs – Optional arguments that
request
takes.
Returns: Response
objectReturn type: requests.Response
- url – URL for the new
-
faux.client.
post
(*args, **kwargs)¶ Sends a POST request.
Parameters: - url – URL for the new
Request
object. - data – (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the
Request
. - json – (optional) json data to send in the body of the
Request
. - **kwargs – Optional arguments that
request
takes.
Returns: Response
objectReturn type: requests.Response
- url – URL for the new
-
faux.client.
put
(*args, **kwargs)¶ Sends a PUT request.
Parameters: - url – URL for the new
Request
object. - data – (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the
Request
. - json – (optional) json data to send in the body of the
Request
. - **kwargs – Optional arguments that
request
takes.
Returns: Response
objectReturn type: requests.Response
- url – URL for the new
-
faux.client.
delete
(*args, **kwargs)¶ Sends a DELETE request.
Parameters: - url – URL for the new
Request
object. - **kwargs – Optional arguments that
request
takes.
Returns: Response
objectReturn type: requests.Response
- url – URL for the new
Mocking Servers¶
-
class
faux.server.
Server
(*args, **kwargs)¶ Object mimicking flask server to allow for spinning up server mock.
-
init
()¶ Method for decorating custom url handlers on server.
-
logger
¶ Expose flask logger so user can change settings.
- TODO: update this class to use __getattr__ for defaulting
- to internal getattr(self.flask, item)
-
route
(*args, **kwargs)¶ Override flask route decorator to provide easier UX for return data. With these changes, users can simply return a dictionary or xml Element object instead of needing to craft a full response.
-
-
class
faux.server.
Instance
(app, **kwargs)¶ Contextmanager for running managing server mock.