keystoneauth1.fixture.serializer module

A serializer to emit YAML but with request body in nicely formatted JSON.

class keystoneauth1.fixture.serializer.YamlJsonSerializer

Bases: BaseSerializer

__doc__ = None
__module__ = 'keystoneauth1.fixture.serializer'
deserialize(cassette_data: str) → Any

A method that must be implemented by the Serializer author.

The return value is extremely important. If it is not empty, the dictionary returned must have the following structure:

{
    'http_interactions': [{
        # Interaction
    },
    {
        # Interaction
    }],
    'recorded_with': 'name of recorder'
}
Params str cassette_data:

The data serialized as a string which needs to be deserialized.

Returns:

dictionary

static generate_cassette_name(cassette_library_dir: str, cassette_name: str) → str
name = 'yamljson'
serialize(cassette_data: dict[str, Any]) → str

A method that must be implemented by the Serializer author.

Parameters:

cassette_data (dict) – A dictionary with two keys: http_interactions, recorded_with.

Returns:

Serialized data as a string.

class keystoneauth1.fixture.serializer._SerializedHTTPMessage

Bases: TypedDict

__annotations__ = {'headers': dict[str, list[str]]}
__dict__ = mappingproxy({'__module__': 'keystoneauth1.fixture.serializer', '__annotations__': {'headers': dict[str, list[str]]}, '__orig_bases__': (<function TypedDict>,), '__dict__': <attribute '__dict__' of '_SerializedHTTPMessage' objects>, '__weakref__': <attribute '__weakref__' of '_SerializedHTTPMessage' objects>, '__doc__': None, '__required_keys__': frozenset({'headers'}), '__optional_keys__': frozenset(), '__total__': True})
__doc__ = None
__module__ = 'keystoneauth1.fixture.serializer'
__optional_keys__ = frozenset({})
__orig_bases__ = (<function TypedDict>,)
__required_keys__ = frozenset({'headers'})
__total__ = True
__weakref__

list of weak references to the object

headers: dict[str, list[str]]
keystoneauth1.fixture.serializer._indent_json(val: str | None) → str
keystoneauth1.fixture.serializer._is_json_body(interaction: _SerializedHTTPMessage) → bool
keystoneauth1.fixture.serializer._represent_scalar(self: BaseRepresenter, tag: str, value: str, style: str | None = None) → ScalarNode
keystoneauth1.fixture.serializer._should_use_block(value: str) → bool
keystoneauth1.fixture.serializer._unicode_representer(dumper: Dumper, uni: str) → ScalarNode