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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_aws_apigateway-0.7.1.tar.gz.
File metadata
- Download URL: pytest_aws_apigateway-0.7.1.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45c22929c75157686d41b5aeaeea79bd83a625b16a4b8aba4d212275dd0a34fe
|
|
| MD5 |
074e512e0e73df9480d94f2bdfdd4020
|
|
| BLAKE2b-256 |
130f5fb0838831f29768d3e28d60af7864d81ea040bd4c8d71684afd332ca86d
|
File details
Details for the file pytest_aws_apigateway-0.7.1-py3-none-any.whl.
File metadata
- Download URL: pytest_aws_apigateway-0.7.1-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4eed118a82b4d1a4784603fc2d1c0797fe6f3849d1dfd954fb62931fc07523b6
|
|
| MD5 |
50d9acf40bd520071fd5e3b59fd147ca
|
|
| BLAKE2b-256 |
73a513c54982df610d41e7648e155ad8913ac90fd765f95d218ada31a9d37c23
|