Skip to content

Commit 911bf4c

Browse files
committed
Update Usage block
1 parent bbb7143 commit 911bf4c

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

README.rst

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Features
2424
- Launch the local gateway per test function
2525
- Provide an abstracted client fixture to access the local gateway
2626
- Expose an interface to overwrite response context with arbitrary objects
27-
- As of Chalice version 1.8.0, `LocalGateway` object doesn't handle Cognito's context
27+
- As of Chalice version 1.8.0, LocalGateway object doesn't handle Cognito's context
2828
- Not only for this purpose, it's an interface provided to allow custom contexts in unit tests
2929

3030

@@ -46,9 +46,28 @@ You can install "pytest-chalice" via `pip`_ from `PyPI`_::
4646
Usage
4747
-----
4848

49-
.. literalinclude:: examples/simple/app.py
49+
.. code-block:: python
50+
51+
from chalice import Chalice
52+
53+
app = Chalice(__name__)
54+
55+
56+
@app.route('/')
57+
def index:
58+
return {'hello': 'world'}
59+
60+
61+
.. code-block:: python
62+
63+
from http import HTTPStatus
64+
65+
66+
def test_index(client):
67+
response = client.get('/')
68+
assert response.status_code == HTTPStatus.OK
69+
assert response.json == {'hello': 'world'}
5070
51-
.. literalinclude:: examples/simple/tests/test_app.py
5271
5372
See `examples <https://github.com/studio3104/pytest-chalice/tree/master/examples>`_ for more detailed
5473

0 commit comments

Comments
 (0)