pytest_httpx_recorder.recorder.set
This module provides the ResSet class for managing sets of recorded HTTP responses, along with functionality to save and load these sets from the filesystem.
- Classes:
ResSet: Manages a set of RecordedResponse objects.
- Functions:
_fake_get_content_decoder: Overrides the default content decoder in httpx.Response.
ResSet
- class pytest_httpx_recorder.recorder.set.ResSet(responses: List[RecordedResponse])[source]
A data class for managing a set of RecordedResponse objects.
- Parameters:
responses (List[RecordedResponse]) – A list of RecordedResponse objects.
- add_to_mock(mock: HTTPXMock)[source]
Adds all recorded responses in this set to an HTTPXMock object.
- Parameters:
mock (HTTPXMock) – The mock to add responses to.
- classmethod load(index_dir: str, ignore_request_headers: bool = False, ignore_request_body: bool = False) ResSet [source]
Loads a set of recorded responses from the filesystem.
- Parameters:
index_dir (str) – Directory where responses are stored.
ignore_request_headers (bool) – Flag to ignore request headers while loading.
ignore_request_body (bool) – Flag to ignore request body while loading.
- Returns:
An instance of ResSet loaded with the recorded responses.
- Return type: