Skip to content

Commit

Permalink
feat(docs): add example docs
Browse files Browse the repository at this point in the history
  • Loading branch information
h2non committed Mar 8, 2017
1 parent 95366fe commit 8139c80
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
9 changes: 5 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

|Build Status| |PyPI| |Coverage Status| |Documentation Status| |Stability| |Quality| |Versions|

grappa-http
-----------
About
-----

`grappa`_ plugin for HTTP assertions.
HTTP assertions plugin for `grappa`_.

To get started, take a look to the `documentation`_ and `tutorial`_.
To get started, take a look to the `documentation`_, `tutorial`_ and `examples`_.

Features
--------
Expand Down Expand Up @@ -48,6 +48,7 @@ Or install the latest sources from Github:
.. _`grappa`: https://grappa.readthedocs.io
.. _`documentation`: http://grappa-http.readthedocs.io
.. _`tutorial`: http://grappa-http.readthedocs.io/en/latest/tutorial.html
.. _`examples`: http://grappa-http.readthedocs.io/en/latest/examples.html

.. |Build Status| image:: https://travis-ci.org/grappa-python/grappa-http.svg?branch=master
:target: https://travis-ci.org/grappa-python/grappa-http
Expand Down
14 changes: 14 additions & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Examples
========

Basic response assertion
------------------------

.. code-block:: python
res = requests.get('http://httpbin.org/status/204')
res | should.be.response.status(204)
# Or alternatively using the string notation
res | should.be.response.status('No Content')
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Contents

intro
tutorial
examples
operators
api
contributing
Expand Down
3 changes: 2 additions & 1 deletion grappa_http/operators/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def _match(self, res, status):

self.subject = res.status_code
if isinstance(status, str):
self.subject = res.status
status = status.lower()
self.subject = res.status.lower()

return self.subject == status, []

0 comments on commit 8139c80

Please sign in to comment.