Roman Isecke 59e850bbd9
Roman/downstream connector cli subcommand (#1302)
### Description
Update all other connectors to use the new downstream architecture that
was recently introduced for the s3 connector.

Closes #1313 and #1311
2023-09-11 11:40:56 -04:00

28 lines
840 B
Python

import pytest
from unstructured.ingest.error import (
DestinationConnectionError,
PartitionError,
SourceConnectionError,
)
@pytest.mark.parametrize(
("error_class", "exception_type", "error_message"),
[
(SourceConnectionError, ValueError, "Simulated connection error"),
(DestinationConnectionError, RuntimeError, "Simulated connection error"),
(PartitionError, FileNotFoundError, "Simulated partition error"),
],
)
def test_custom_error_decorator(error_class, exception_type, error_message):
@error_class.wrap
def simulate_error():
raise exception_type(error_message)
with pytest.raises(error_class) as context:
simulate_error()
expected_error_string = error_class.error_string.format(error_message)
assert str(context.value) == expected_error_string