Metadata-Version: 2.1
Name: pytest-aws-apigateway
Version: 0.6.0
Summary: pytest plugin for AWS ApiGateway
Author-email: Felix Scherz <felixwscherz@gmail.com>
License: MIT License
        
        Copyright (c) 2024-present Felix Scherz <felixwscherz@gmail.com>
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        
Project-URL: Documentation, https://github.com/felixscherz/pytest-aws-apigateway#readme
Project-URL: Issues, https://github.com/felixscherz/pytest-aws-apigateway/issues
Project-URL: Source, https://github.com/felixscherz/pytest-aws-apigateway
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Framework :: Pytest
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pytest
Requires-Dist: pytest-httpx
Requires-Dist: httpx

# pytest-aws-apigateway

[![PyPI - Version](https://img.shields.io/pypi/v/pytest-aws-apigateway.svg)](https://pypi.org/project/pytest-aws-apigateway)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytest-aws-apigateway.svg)](https://pypi.org/project/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.

```python
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://some/")
        assert resp.json() == {"message": "Hello World!"}
```


## License

`pytest-aws-apigateway` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
