3.0.ipv8.test.REST.rest_base
Classes
Functions
Module Contents
- class 3.0.ipv8.test.REST.rest_base.BodyCapture
Bases:
io.BytesIO,aiohttp.abc.AbstractStreamWriterHelper-class to capture RESTResponse bodies.
- class 3.0.ipv8.test.REST.rest_base.MockRequest(path: str = '', method: str = 'GET', query: dict | None = None, match_info: dict[str, str] | None = None, payload_writer: aiohttp.abc.AbstractStreamWriter | None = None)
Bases:
aiohttp.web_request.RequestBase class for mocked REST requests.
- _transport
- _query
- _match_info
- property match_info: aiohttp.web_urldispatcher.UrlMappingMatchInfo
Get the match info (the infohash in the url).
- property query: multidict.MultiDictProxy[str]
Overwrite the query with the query passed in our constructor.
- async json(*, loads: aiohttp.typedefs.JSONDecoder = DEFAULT_JSON_DECODER) dict
Get the json equivalent of the query (i.e., just the query).
- property transport: asyncio.Transport | None
Overwrite the transport with our fake transport.
- async 3.0.ipv8.test.REST.rest_base.response_to_bytes(response: aiohttp.web.Response) bytes
Get the bytes of a RESTResponse’s body.
- async 3.0.ipv8.test.REST.rest_base.response_to_json(response: aiohttp.web.Response) Any
Get the JSON dict of a RESTResponse’s body.