paperap.plugins.collect_test_data module


METADATA:

File: collect_test_data.py

Project: paperap

Created: 2025-03-04

Version: 0.0.10

Author: Jess Mann Email: jess@jmann.me

Copyright (c) 2025 Jess Mann


LAST MODIFIED:

2025-03-04 By Jess Mann

class paperap.plugins.collect_test_data.SampleDataCollector(**kwargs)[source]

Bases: Plugin

Plugin to collect test data from API responses.

Parameters:

kwargs (Any)

name: ClassVar[str] = 'test_data_collector'
description: ClassVar[str] = 'Collects sample data from API responses for testing purposes'
version: ClassVar[str] = '0.0.3'
fake: Faker
test_dir: Path
classmethod validate_test_dir(value)[source]

Validate the test directory path.

Parameters:

value (Any)

Return type:

Path | None

setup()[source]

Register signal handlers.

Return type:

None

teardown()[source]

Unregister signal handlers.

Return type:

None

save_response(filepath, response, **kwargs)[source]

Save the response to a JSON file.

Parameters:
  • filepath (Path)

  • response (TypeAliasType | None)

  • kwargs (Any)

Return type:

None

save_list_response(sender, response, **kwargs)[source]

Save the list response to a JSON file.

Parameters:
Return type:

TypeVar(R, bound= TypeAliasType | None)

save_first_item(sender, item, **kwargs)[source]

Save the first item from a list to a JSON file.

Parameters:
Return type:

TypeVar(R, bound= dict[str, Any])

save_parsed_response(parsed_response, method, params, json_response, endpoint, **kwargs)[source]

Save the request data to a JSON file.

Connects to client.request:after signal.

Parameters:
Return type:

dict[str, Any]

classmethod get_config_schema()[source]

Define the configuration schema for this plugin.

Return type:

dict[str, Any]

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'ignore', 'from_attributes': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].