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 @@ -138,3 +138,26 @@ async def get_async():
138
138
139
139
# THEN
140
140
assert asyncio .run (result ) == "value"
141
+
142
+
143
+ def test_resolve_custom_model ():
144
+ # Check whether we can handle an example appsync direct resolver
145
+ mock_event = load_event ("appSyncDirectResolver.json" )
146
+
147
+ class MyCustomModel (AppSyncResolverEvent ):
148
+ @property
149
+ def country_viewer (self ):
150
+ return self .request_headers .get ("cloudfront-viewer-country" )
151
+
152
+ app = AppSyncResolver ()
153
+
154
+ @app .resolver (field_name = "createSomething" )
155
+ def create_something (id : str ): # noqa AA03 VNE003
156
+ return id
157
+
158
+ # Call the implicit handler
159
+ result = app (event = mock_event , context = LambdaContext (), model = MyCustomModel )
160
+
161
+ assert result == "my identifier"
162
+
163
+ assert app .current_event .country_viewer == "US"
You can’t perform that action at this time.
0 commit comments