exb_sdk.workflow_client.test_client

Attributes

Exceptions

ResultNotFoundError

Raised when a result is not found by the TestClient.

Classes

TestClient

A client that can be used when writing tests.

Module Contents

exception exb_sdk.workflow_client.test_client.ResultNotFoundError(document_path)[source]

Bases: Exception

Raised when a result is not found by the TestClient.

Parameters:

document_path (pathlib.Path)

message
exb_sdk.workflow_client.test_client.Results
class exb_sdk.workflow_client.test_client.TestClient[source]

Bases: exb_sdk.workflow_client.client.Client

A client that can be used when writing tests.

>>> from exb_sdk.workflow_client import TestClient
>>> workflow_client = TestClient.create(results={Path("mydoc.pdf"): {"documentId": "1234"}})
>>> await my_processing_function(workflow_client=workflow_client)
__test__ = False
results: Results
classmethod create(results)[source]

Create a test client by configuring results.

This should be the only method used for creating a TestClient.

Parameters:

results (Results) – A dictionary of document paths to their result.

Returns:

A new TestClient instance.

Return type:

Self

async get_result(document_path)[source]

An overridden method for the test client not to make any external requests.

Parameters:

document_path (pathlib.Path) – The path of the document to be uploaded and extracted.

Raises:

ResultNotFoundError – if the document_path is not part of the pre-configured results.

Returns:

The result of the pre-configured document as a dictionary.

Return type:

exb_sdk.workflow_client.client.Result