Skip to content

Commit 4382381

Browse files
committed
chore: format
1 parent cc11666 commit 4382381

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

unit_tests/connector_builder/test_connector_builder_handler.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,24 +1412,24 @@ def test_read_stream_error_message_does_not_contain_config_and_catalog():
14121412
"""
14131413
Test that error messages in read_stream are clean and user-friendly,
14141414
without embedding verbose config and catalog information.
1415-
1415+
14161416
This test verifies that:
14171417
1. The user-facing `message` is clean and doesn't contain config/catalog dumps
14181418
2. The technical `internal_message` still contains full context for debugging
14191419
"""
14201420
# Create a config and catalog with identifiable content
14211421
config = {
1422-
"__injected_declarative_manifest": "test_manifest",
1422+
"__injected_declarative_manifest": "test_manifest",
14231423
"verbose_config_data": "this_should_not_appear_in_user_message",
1424-
"api_key": "secret_key_value"
1424+
"api_key": "secret_key_value",
14251425
}
14261426
catalog = ConfiguredAirbyteCatalog(
14271427
streams=[
14281428
ConfiguredAirbyteStream(
14291429
stream=AirbyteStream(
1430-
name=_stream_name,
1431-
json_schema={"properties": {"verbose_catalog_schema": {"type": "string"}}},
1432-
supported_sync_modes=[SyncMode.full_refresh]
1430+
name=_stream_name,
1431+
json_schema={"properties": {"verbose_catalog_schema": {"type": "string"}}},
1432+
supported_sync_modes=[SyncMode.full_refresh],
14331433
),
14341434
sync_mode=SyncMode.full_refresh,
14351435
destination_sync_mode=DestinationSyncMode.append,
@@ -1446,25 +1446,30 @@ def test_read_stream_error_message_does_not_contain_config_and_catalog():
14461446
"airbyte_cdk.connector_builder.test_reader.TestReader.run_test_read"
14471447
) as mock_handler:
14481448
# Simulate a common error like a datetime parsing error
1449-
mock_handler.side_effect = ValueError("time data '' does not match format '%Y-%m-%dT%H:%M:%SZ'")
1449+
mock_handler.side_effect = ValueError(
1450+
"time data '' does not match format '%Y-%m-%dT%H:%M:%SZ'"
1451+
)
14501452

14511453
# Call the read_stream function
14521454
response = read_stream(mock_source, config, catalog, state, limits)
14531455

14541456
# Verify it's a trace message with an error
14551457
assert response.type == Type.TRACE
14561458
assert response.trace.type.value == "ERROR"
1457-
1459+
14581460
# The user-facing message should be clean - no config or catalog dumps
14591461
user_message = response.trace.error.message
14601462
assert "verbose_config_data" not in user_message
14611463
assert "verbose_catalog_schema" not in user_message
14621464
assert "__injected_declarative_manifest" not in user_message
1463-
1465+
14641466
# But it should contain the actual error
14651467
stream_name = catalog.streams[0].stream.name
1466-
assert user_message == f"Error reading stream {stream_name}: time data '' does not match format '%Y-%m-%dT%H:%M:%SZ'"
1467-
1468+
assert (
1469+
user_message
1470+
== f"Error reading stream {stream_name}: time data '' does not match format '%Y-%m-%dT%H:%M:%SZ'"
1471+
)
1472+
14681473
# The internal message should contain technical details for debugging
14691474
internal_message = response.trace.error.internal_message
14701475
assert "verbose_config_data" in internal_message

0 commit comments

Comments
 (0)