def test_resolve_custom_data_model():
    mock_event = load_event('appSyncDirectResolver.json')

    class MyCustomModel(AppSyncResolverEvent):

        @property
        def country_viewer(self):
            return self.request_headers.get('cloudfront-viewer-country')
    app = AppSyncResolver()

    @app.resolver(field_name='createSomething')
    def create_something(id: str):
        return id
    result = app(event=mock_event, context=LambdaContext(), data_model=MyCustomModel)
    assert (result == 'my identifier')
    assert (app.current_event.country_viewer == 'US')
def test_resolve_custom_data_model():
    mock_event = load_event('appSyncDirectResolver.json')

    class MyCustomModel(AppSyncResolverEvent):

        @property
        def country_viewer(self):
            return self.request_headers.get('cloudfront-viewer-country')
    app = AppSyncResolver()

    @app.resolver(field_name='createSomething')
    def create_something(id: str):
        return id
    result = app(event=mock_event, context=LambdaContext(), data_model=MyCustomModel)
    assert (result == 'my identifier')
    assert (app.current_event.country_viewer == 'US')