Skip to content

Commit 34e0e0e

Browse files
whummerclaude
andcommitted
clean up API Gateway v1/v2 proxy tests: remove logger, use pytest.raises
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1f3efcb commit 34e0e0e

2 files changed

Lines changed: 6 additions & 18 deletions

File tree

aws-proxy/tests/proxy/test_apigateway.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Note/disclosure: This file has been (partially or fully) generated by an AI agent.
2-
import logging
3-
1+
# Note: This file has been (partially or fully) generated by an AI agent.
42
import boto3
53
import pytest
64
from botocore.exceptions import ClientError
@@ -9,8 +7,6 @@
97

108
from aws_proxy.shared.models import ProxyConfig
119

12-
logger = logging.getLogger(__name__)
13-
1410

1511
def test_apigateway_rest_api_requests(start_aws_proxy, cleanups):
1612
api_name_aws = f"test-api-aws-{short_uid()}"
@@ -238,8 +234,8 @@ def test_apigateway_read_only_mode(start_aws_proxy, cleanups):
238234
# allow write operations to be proxied
239235
original_description = get_api_aws.get("description", "")
240236

241-
# Attempt write operation - should either be blocked or not proxied
242-
try:
237+
# Attempt write operation - should be blocked in read-only mode
238+
with pytest.raises(Exception):
243239
apigw_client.update_rest_api(
244240
restApiId=api_id_aws,
245241
patchOperations=[
@@ -250,8 +246,6 @@ def test_apigateway_read_only_mode(start_aws_proxy, cleanups):
250246
}
251247
],
252248
)
253-
except Exception as e:
254-
logger.info(f"Read-only mode blocked write operation: {e}")
255249

256250
# Verify the API description was not changed in AWS
257251
get_api_aws_after = apigw_client_aws.get_rest_api(restApiId=api_id_aws)

aws-proxy/tests/proxy/test_apigatewayv2.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Note/disclosure: This file has been (partially or fully) generated by an AI agent.
2-
3-
import logging
1+
# Note: This file has been (partially or fully) generated by an AI agent.
42

53
import boto3
64
import pytest
@@ -10,8 +8,6 @@
108

119
from aws_proxy.shared.models import ProxyConfig
1210

13-
logger = logging.getLogger(__name__)
14-
1511

1612
def test_apigatewayv2_http_api_requests(start_aws_proxy, cleanups):
1713
"""Test basic API Gateway v2 HTTP API operations with proxy."""
@@ -225,11 +221,9 @@ def test_apigatewayv2_read_only_mode(start_aws_proxy, cleanups):
225221
# write operations should not be proxied in read-only mode
226222
original_description = get_api_aws.get("Description", "")
227223

228-
# Attempt write operation - should either be blocked or not proxied
229-
try:
224+
# Attempt write operation - should be blocked in read-only mode
225+
with pytest.raises(Exception):
230226
apigwv2_client.update_api(ApiId=api_id_aws, Description="Should not reach AWS")
231-
except Exception as e:
232-
logger.info(f"Read-only mode blocked write operation: {e}")
233227

234228
# Verify the API description was not changed in AWS
235229
get_api_aws_after = apigwv2_client_aws.get_api(ApiId=api_id_aws)

0 commit comments

Comments
 (0)