-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_lambda_handler.py
More file actions
36 lines (27 loc) · 949 Bytes
/
Copy pathtest_lambda_handler.py
File metadata and controls
36 lines (27 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
"""Quick test of lambda_handler to verify awsgi integration."""
from app.lambda_handler import handler
# Simulate a Lambda Function URL event
test_event = {
"rawPath": "/health",
"requestContext": {"http": {"method": "GET", "path": "/health"}},
"headers": {},
"queryStringParameters": None,
"body": None,
"isBase64Encoded": False,
}
class FakeContext:
request_id = "test-request-123"
try:
response = handler(test_event, FakeContext())
print("✓ Lambda handler executed successfully")
print(f"Status: {response.get('statusCode')}")
print(f"Body preview: {response.get('body', '')[:100]}")
if response.get("statusCode") == 200:
print("\n✓ Handler returned 200 OK")
else:
print(f"\n✗ Handler returned {response.get('statusCode')}")
except Exception as e:
print(f"✗ Lambda handler failed: {e}")
import traceback
traceback.print_exc()