Last updated:
0 purchases
pytestawsapigateway 0.7.1
pytest-aws-apigateway
Rationale
pytest_aws_apigateway is a pytest plugin to make testing AWS Lambda integrations with AWS ApiGateway easier.
It registers AWS Lambda function handlers as callbacks to requests made using httpx so you can test your
REST API using HTTP requests.
Usage
Add integrations
pytest-aws-apigateway lets you register AWS Lambda function handlers to act just like AWS ApiGateway proxy
integrations.
import httpx
from pytest_aws_apigateway import ApiGatewayMock
def handler(event, context):
return {"statusCode": 200, "body": json.dumps({"message": "Hello World!"})}
def test_hello_world(apigateway_mock: ApiGatewayMock):
apigateway_mock.add_integration(
"/", handler=handler, method="GET", endpoint="https://greetings/"
)
with httpx.Client() as client:
resp = client.get("https://greetings/")
assert resp.json() == {"message": "Hello World!"}
License
pytest-aws-apigateway is distributed under the terms of the MIT license.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.