pytest-chalice
A set of py.test fixtures for AWS Chalice
Features
Launch the local gateway per test function
Provide an abstracted client fixture to access the local gateway
- Expose an interface to overwrite response context with arbitrary objects
As of Chalice version 1.8.0, LocalGateway object doesn’t handle Cognito’s context
Not only for this purpose, it’s an interface provided to allow custom contexts in unit tests
Requirements
Installation
You can install “pytest-chalice” via pip from PyPI:
$ pip install pytest-chalice
Usage
from chalice import Chalice
app = Chalice(__name__)
@app.route('/')
def index:
return {'hello': 'world'}
pytest-chalice expects a fixture called app which will be the chalice app instance from your project. You can create it in your conftest.py:
import pytest
from chalice import Chalice
from project.app import app as chalice_app
@pytest.fixture
def app() -> Chalice:
return chalice_app
from http import HTTPStatus
def test_index(client):
response = client.get('/')
assert response.status_code == HTTPStatus.OK
assert response.json == {'hello': 'world'}
See examples for more detailed
Contributing
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
License
Distributed under the terms of the MIT license, “pytest-chalice” is free and open source software
Issues
If you encounter any problems, please file an issue along with a detailed description.
Metadata
Release files for pytest-chalice 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest-chalice-0.0.5.tar.gz | 15.0 kB | Without provenance | Details for pytest-chalice-0.0.5.tar.gz |
Release files / pytest-chalice-0.0.5.tar.gz
| Download URL | pytest-chalice-0.0.5.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f357d53d123b201c9e6235f67f8ef6a4310bdfea67f75ee4dbe4aed0f19e319a
|
|
BLAKE2b-256 checksum How to use checksums |
6e0f3344996a9ca6d1b301f55805bd2aa0daf9055f13317720b4567226e4cb38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.7
|
Security for pytest-chalice 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.