An HTTP API centric BDD style test framework
Project description
Expectly - An HTTP API centric BDD style test framework
-------------------------------------------------------
|travis| |pypi| |docs|
Use Cases:
- Making assertions about api responses more readable
- Extending expectly with new assertions to reduce boilerplate
.. DANGER::
This library is in alpha. I will try my utmost to not make backwards incompatible changes
but it is possible that
Installing
==========
.. code-block:: shell
$ pip install expectly
API Examples
============
Built In Assertion methods
**************************
.. code-block:: python
# status_code (with status code number)
expect(response).to.have.status_code(200)
# header (asserts the header exists). Sets the header value to be further tested against
expect(response).to.have.header('Content-Type')
# equals
expect(response).to.have.header('Content-Type').equal('application/json')
# like (does a regex match against the value)
expect(response).to.have.header('Content-Type').like('application')
# exactly_like (does a regex match against the whole value
expect(response).to.have.header('Content-Type').exactly_like('^application/[\w]*$')
# encoding
expect(response).to.have.encoding('utf-8')
# ok (uses requests.response.ok attribute)
expect(response).to.be.ok
Extending expectly.expect with additional assertions
****************************************************
TODO
JSON handling in expectly
*************************
jsonschema is used for evaluating whether json responses match the relevant schema
jmespath is used for navigating/selecting information to test inside of the json response
Development
===========
.. code-block:: shell
$ git clone https://github.com/huntcsg/expectly.git
$ cd expectly
$ ./utils/manage clean
$ ./utils/manage test
$ ./utils/manage docs
1. All pull requests must pass the travis-ci builds
2. All pull requests should include inline (docstring) documentation, updates to built documentation if applicable,
and test coverage. This project aspires to be a 100% test coverage library.
.. |travis| image:: https://travis-ci.org/huntcsg/expectly.svg?branch=master
:target: https://travis-ci.org/huntcsg/expectly
.. |pypi| image:: https://img.shields.io/pypi/v/expectly.svg
:target: https://pypi.python.org/pypi/expectly
.. |docs| image:: https://readthedocs.org/projects/expectly/badge/?version=latest
:target: http://expectly.readthedocs.io/en/latest/?badge=latest
Changes
=======
0.1.0
*****
- Initial Release
Authors
-------
Hunter Senft-Grupp
-------------------------------------------------------
|travis| |pypi| |docs|
Use Cases:
- Making assertions about api responses more readable
- Extending expectly with new assertions to reduce boilerplate
.. DANGER::
This library is in alpha. I will try my utmost to not make backwards incompatible changes
but it is possible that
Installing
==========
.. code-block:: shell
$ pip install expectly
API Examples
============
Built In Assertion methods
**************************
.. code-block:: python
# status_code (with status code number)
expect(response).to.have.status_code(200)
# header (asserts the header exists). Sets the header value to be further tested against
expect(response).to.have.header('Content-Type')
# equals
expect(response).to.have.header('Content-Type').equal('application/json')
# like (does a regex match against the value)
expect(response).to.have.header('Content-Type').like('application')
# exactly_like (does a regex match against the whole value
expect(response).to.have.header('Content-Type').exactly_like('^application/[\w]*$')
# encoding
expect(response).to.have.encoding('utf-8')
# ok (uses requests.response.ok attribute)
expect(response).to.be.ok
Extending expectly.expect with additional assertions
****************************************************
TODO
JSON handling in expectly
*************************
jsonschema is used for evaluating whether json responses match the relevant schema
jmespath is used for navigating/selecting information to test inside of the json response
Development
===========
.. code-block:: shell
$ git clone https://github.com/huntcsg/expectly.git
$ cd expectly
$ ./utils/manage clean
$ ./utils/manage test
$ ./utils/manage docs
1. All pull requests must pass the travis-ci builds
2. All pull requests should include inline (docstring) documentation, updates to built documentation if applicable,
and test coverage. This project aspires to be a 100% test coverage library.
.. |travis| image:: https://travis-ci.org/huntcsg/expectly.svg?branch=master
:target: https://travis-ci.org/huntcsg/expectly
.. |pypi| image:: https://img.shields.io/pypi/v/expectly.svg
:target: https://pypi.python.org/pypi/expectly
.. |docs| image:: https://readthedocs.org/projects/expectly/badge/?version=latest
:target: http://expectly.readthedocs.io/en/latest/?badge=latest
Changes
=======
0.1.0
*****
- Initial Release
Authors
-------
Hunter Senft-Grupp
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
expectly-0.1.1.tar.gz
(8.1 kB
view hashes)
Built Distribution
Close
Hashes for expectly-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 708d9c377c486a3f549896afb17d98198fa5dfc9e25e5e6523339a871bcb89ac |
|
MD5 | 7051abcbb4cba91c668f49f192d55e27 |
|
BLAKE2b-256 | 1d8c9fed4c3bea89a432fb1ecf4098eb1389d2ba87eb266ee8db8eff53b7b250 |