File tree 1 file changed +23
-0
lines changed
tests/functional/event_handler
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,29 @@ def claims():
79
79
assert result ["response" ]["httpStatusCode" ] == 404
80
80
81
81
82
+ def test_bedrock_agent_event_with_validation_error ():
83
+ # GIVEN a Bedrock Agent event
84
+ app = BedrockAgentResolver ()
85
+
86
+ @app .get ("/claims" )
87
+ def claims () -> Dict [str , Any ]:
88
+ return "oh no, this is not a dict" # type: ignore
89
+
90
+ # WHEN calling the event handler
91
+ result = app (load_event ("bedrockAgentEvent.json" ), {})
92
+
93
+ # THEN process event correctly
94
+ # AND set the current_event type as BedrockAgentEvent
95
+ assert result ["messageVersion" ] == "1.0"
96
+ assert result ["response" ]["apiPath" ] == "/claims"
97
+ assert result ["response" ]["actionGroup" ] == "ClaimManagementActionGroup"
98
+ assert result ["response" ]["httpMethod" ] == "GET"
99
+ assert result ["response" ]["httpStatusCode" ] == 422
100
+
101
+ body = result ["response" ]["responseBody" ]["application/json" ]["body" ]
102
+ assert "value is not a valid dict" in body
103
+
104
+
82
105
def test_bedrock_agent_event_with_exception ():
83
106
# GIVEN a Bedrock Agent event
84
107
app = BedrockAgentResolver ()
You can’t perform that action at this time.
0 commit comments