pytest plugin for AWS ApiGateway
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for pytest_aws_apigateway-0.7.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45c22929c75157686d41b5aeaeea79bd83a625b16a4b8aba4d212275dd0a34fe |
|
MD5 | 074e512e0e73df9480d94f2bdfdd4020 |
|
BLAKE2b-256 | 130f5fb0838831f29768d3e28d60af7864d81ea040bd4c8d71684afd332ca86d |
Close
Hashes for pytest_aws_apigateway-0.7.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4eed118a82b4d1a4784603fc2d1c0797fe6f3849d1dfd954fb62931fc07523b6 |
|
MD5 | 50d9acf40bd520071fd5e3b59fd147ca |
|
BLAKE2b-256 | 73a513c54982df610d41e7648e155ad8913ac90fd765f95d218ada31a9d37c23 |