{ "info": { "author": "Tomas Aparicio", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ".. image:: http://i.imgur.com/kKZPYut.jpg\n :width: 100%\n :alt: grappa logo\n :align: center\n\n\n|Build Status| |PyPI| |Coverage Status| |Documentation Status| |Stability| |Quality| |Versions| |SayThanks|\n\nAbout\n-----\n\nHTTP request/response assertion plugin for `grappa`_.\n``grappa-http`` extends ``grappa`` assertion operators with HTTP protocol testing.\n\nTo get started, take a look to the `documentation`_, `tutorial`_ and `examples`_.\n\nStatus\n------\n\n``grappa-http`` is still **beta quality** software.\n\nShowcase\n--------\n\n.. code-block:: python\n\n import pook\n import requests\n from grappa_http import should\n\n # Activate the HTTP mock engine\n pook.on()\n\n # Register a sample mock\n pook.get('server.org/foo?bar=baz', reply=200,\n response_headers={'Server': 'nginx'},\n response_json={'foo': 'bar'})\n\n # Perform HTTP request\n res = requests.get('http://server.org/foo?bar=baz')\n\n # Test response status to be OK\n res | should.be.ok\n # Or alternatively using the status code\n res | should.have.status(200)\n\n # Test request URL\n res | should.have.url.hostname('server.org')\n res | should.have.url.port(80)\n res | should.have.url.path('/foo')\n res | should.have.url.query.params({'bar': 'baz'})\n\n # Test response body MIME content type\n res | should.have.content('json')\n\n # Test response headers\n (res | (should.have.header('Content-Type')\n .that.should.be.equal('application/json')))\n res | should.have.header('Server').that.should.contain('nginx')\n\n # Test response body\n res | should.have.body.equal.to('{\\n \"foo\": \"bar\"\\n}')\n res | should.have.body.that.contains('foo')\n\n # Test response body length\n res | should.have.body.length.of(20)\n res | should.have.body.length.higher.than(10)\n\n # Test response JSON body\n res | should.have.json.equal.to({'foo': 'bar'})\n res | should.have.json.have.key('foo') > should.be.equal.to('bar')\n\n # Validate response JSON bodies using JSONSchema\n res | should.implement.jsonschema({\n '$schema': 'http://json-schema.org/draft-04/schema#',\n 'title': 'Response JSON',\n 'type': 'object',\n 'required': ['foo'],\n 'properties': {\n 'foo': {\n 'description': 'foo always means foo',\n 'type': 'string'\n }\n }\n })\n\n\nFull-featured error report example:\n\n.. code-block:: python\n\n Traceback (most recent call last):\n File \"grappa-http/tests/http_test.py\", line 38, in test_http_tutorial\n res | should.have.body.equal.to('{\\n \"foo\": \"baa\"\\n}')\n File \"grappa/grappa/test.py\", line 208, in __ror__\n return self.__overload__(value)\n File \"grappa/grappa/test.py\", line 196, in __overload__\n return self.__call__(subject, overload=True)\n File \"grappa/grappa/test.py\", line 73, in __call__\n return self._trigger() if overload else Test(subject)\n File \"grappa/grappa/test.py\", line 113, in _trigger\n raise err\n AssertionError: Oops! Something went wrong!\n\n The following assertion was not satisfied\n subject \"{\\n \"foo\": \"bar\"\\n}\" should have body equal to \"{\\n \"foo\": \"baa\"\\n}\"\n\n What we expected\n a response body data equal to:\n {\n \"foo\": \"baa\"\n }\n\n What we got instead\n a response body with data:\n {\n \"foo\": \"bar\"\n }\n\n Difference comparison\n > {\n > - \"foo\": \"bar\"\n > ? ^\n > + \"foo\": \"baa\"\n > ? ^\n > }\n\n Where\n File \"grappa-http/tests/http_test.py\", line 38, in test_http_tutorial\n\n 30| res | should.have.content('json')\n 31|\n 32| # Test response headers\n 33| (res | (should.have.header('Content-Type')\n 34| .that.should.be.equal('application/json')))\n 35| res | should.have.header('Server').that.should.contain('nginx')\n 36|\n 37| # Test response body\n 38| > res | should.have.body.equal.to('{\\n \"foo\": \"baa\"\\n}')\n 39| res | should.have.body.that.contains('foo')\n 40|\n 41| # Test response body length\n 42| res | should.have.body.length.of(20)\n 43| res | should.have.body.length.higher.than(10)\n 44|\n 45| # Test response JSON body\n\n\nFeatures\n--------\n\n- Full-featured HTTP response assertions.\n- Supports any protocol primitive assertions.\n- First-class support for JSON body assertion.\n- Built-in JSONSchema validation.\n- Full-features request URL validation.\n- Featured regular expression based assertion.\n- Works with ``requests`` and ``aiohttp`` HTTP clients.\n- Friendly and detailed assertion error reporting with body diff comparisons.\n- Provides both ``expect`` and ``should`` assertion styles.\n- Testing framework agnostic. Works with ``unittest``, ``nosetests``, ``pytest``, ``behave``...\n- Works with Python 2.6+, 3+, PyPy and possibly other Python implementations.\n\nSupported HTTP clients\n----------------------\n\n- \u2714 `requests`_\n- \u2718 `aiohttp`_ (``work in progress``)\n\nInstallation\n------------\n\nUsing ``pip`` package manager:\n\n.. code-block:: bash\n\n pip install --upgrade grappa-http\n\nOr install the latest sources from Github:\n\n.. code-block:: bash\n\n pip install -e git+git://github.com/grappa-py/http.git#egg=grappa\n\n\n.. _Python: http://python.org\n.. _`grappa`: https://grappa.readthedocs.io\n.. _`documentation`: http://grappa-http.readthedocs.io\n.. _`tutorial`: http://grappa-http.readthedocs.io/en/latest/tutorial.html\n.. _`examples`: http://grappa-http.readthedocs.io/en/latest/examples.html\n.. _`requests`: http://docs.python-requests.org/en/master/\n.. _`aiohttp`: http://aiohttp.readthedocs.io/en/stable/\n\n.. |Build Status| image:: https://travis-ci.org/grappa-py/http.svg?branch=master\n :target: https://travis-ci.org/grappa-py/http\n.. |PyPI| image:: https://img.shields.io/pypi/v/grappa-http.svg?maxAge=2592000?style=flat-square\n :target: https://pypi.python.org/pypi/grappa-http\n.. |Coverage Status| image:: https://coveralls.io/repos/github/grappa-py/http/badge.svg?branch=master\n :target: https://coveralls.io/github/grappa-py/http?branch=master\n.. |Documentation Status| image:: https://readthedocs.org/projects/grappa-http/badge/?version=latest\n :target: http://grappa-http.readthedocs.io/en/latest/?badge=latest\n.. |Quality| image:: https://codeclimate.com/github/grappa-py/http/badges/gpa.svg\n :target: https://codeclimate.com/github/grappa-py/http\n :alt: Code Climate\n.. |Stability| image:: https://img.shields.io/pypi/status/grappa-http.svg\n :target: https://pypi.python.org/pypi/grappa-http\n :alt: Stability\n.. |Versions| image:: https://img.shields.io/pypi/pyversions/grappa-http.svg\n :target: https://pypi.python.org/pypi/grappa-http\n :alt: Python Versions\n.. |SayThanks| image:: https://img.shields.io/badge/Say%20Thanks!-%F0%9F%A6%89-1EAEDB.svg\n :target: https://saythanks.io/to/h2non\n :alt: Say Thanks\n\n\n\nHistory\n=======\n\nv0.1.3 / 2017-04-26\n-------------------\n\n * fix(adapters): use issubclass for adapter valid interface.\n\nv0.1.2 / 2017-04-25\n-------------------\n\n * feat(api): add use_adapter() API for custom adapter registering\n * feat(jsonschema): update example which uses satisfy attribute operator\n\nv0.1.1 / 2017-03-29\n-------------------\n\n * feat(requirements): upgrade grappa to latest version\n * feat(operators): add output size limit\n * feat(docs): add thanks badge\n * refactor(docs): update description\n * feat(examples): add featured example\n * fix(package): read version from grappa_http package\n * fix(docs): use grappa_http package\n\n0.1.0 (2017-03-25)\n------------------\n\n* First version (beta)\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/grappa-py/http", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "grappa-http", "package_url": "https://pypi.org/project/grappa-http/", "platform": "", "project_url": "https://pypi.org/project/grappa-http/", "project_urls": { "Homepage": "https://github.com/grappa-py/http" }, "release_url": "https://pypi.org/project/grappa-http/0.1.3/", "requires_dist": null, "requires_python": "", "summary": "HTTP assertion plugin for grappa", "version": "0.1.3" }, "last_serial": 2831477, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "0a2115c2a92ac8b1f954b5849abec53e", "sha256": "bd6d53d08f4314e6df28ebf2d367c8107897209792d0583b64797e582de7fddc" }, "downloads": -1, "filename": "grappa_http-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0a2115c2a92ac8b1f954b5849abec53e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 25227, "upload_time": "2017-03-26T22:50:21", "url": "https://files.pythonhosted.org/packages/2a/e4/f5152c9290d3e0ff65c52db3d3cded32cb67ef60d41c8c1ac41260a759d8/grappa_http-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f5b64d8fef87dd6014b3cc89ad5f1ef0", "sha256": "a13bdb24e2c50a7d45450c5becad79a3fe5f10083b162089f98a355ea783d362" }, "downloads": -1, "filename": "grappa-http-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f5b64d8fef87dd6014b3cc89ad5f1ef0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13861, "upload_time": "2017-03-26T22:50:17", "url": "https://files.pythonhosted.org/packages/c6/73/63a0bdeb81672585fe79927090406c8a065ee4c45745d337c88988dd0370/grappa-http-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "863d85afea3ab8f9b1453ea02f5263f6", "sha256": "12d0bd79a413b7abc4440bd3a49aed35fe506178c501214bfe5bf71b6068b141" }, "downloads": -1, "filename": "grappa_http-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "863d85afea3ab8f9b1453ea02f5263f6", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 26753, "upload_time": "2017-03-29T08:04:03", "url": "https://files.pythonhosted.org/packages/2d/c3/76b903e82c6be30ff635ab69f7b2768c46c0855c5948f3882ac804bba716/grappa_http-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7db89f8d7dfeab6d0b0b9426aa97d4c8", "sha256": "3ee2f765052d1d00ff0aeef888452c2246da695c3a328f3e16621032f6b30e7b" }, "downloads": -1, "filename": "grappa-http-0.1.1.tar.gz", "has_sig": false, "md5_digest": "7db89f8d7dfeab6d0b0b9426aa97d4c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14849, "upload_time": "2017-03-29T08:03:59", "url": "https://files.pythonhosted.org/packages/1f/74/29e922480811bc1f90be13e6a977b191446bd9907f4add31700f87990515/grappa-http-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "77e08189bce61debce57ad25f0b404cf", "sha256": "56327e992fab3f4e641529026fd4e2d5aea8481778ccf1eafe31d0af8b863aaa" }, "downloads": -1, "filename": "grappa_http-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "77e08189bce61debce57ad25f0b404cf", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 27172, "upload_time": "2017-04-25T13:02:07", "url": "https://files.pythonhosted.org/packages/2e/76/9a7bff3c47a1a5feec59eb987ec74fd19ff5543e42182c8c51485bac447d/grappa_http-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a917cf778f28928512ad6ae9d79bc631", "sha256": "fd8f0370e5ecaa8fdcee3a151d43315ce4e63a73471cc029285b3079e1aeca5c" }, "downloads": -1, "filename": "grappa-http-0.1.2.tar.gz", "has_sig": false, "md5_digest": "a917cf778f28928512ad6ae9d79bc631", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15201, "upload_time": "2017-04-25T13:02:03", "url": "https://files.pythonhosted.org/packages/37/96/f0d55486f6783feb6bf0b6242d0f75e604de0c2c3b80a197e90f6e2f9b89/grappa-http-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "4e603f1fb59b094fee791c5144ef9e93", "sha256": "4441dbeb7155d5bd2e43447bd98c9b7a408c2cd33e3841696915eeacd6fc0b67" }, "downloads": -1, "filename": "grappa_http-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4e603f1fb59b094fee791c5144ef9e93", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 27239, "upload_time": "2017-04-26T12:20:20", "url": "https://files.pythonhosted.org/packages/c8/75/e9eedb777a5a662149c4d1bf5ccdc86c1bdbf4c48656d945fddc35e6b6eb/grappa_http-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1fbb48d9ac090936ff569e2906a5ad8e", "sha256": "f08439ca8ecd4fad66b7faa55d831db7655c8abb99927f316873df3432b0d645" }, "downloads": -1, "filename": "grappa-http-0.1.3.tar.gz", "has_sig": false, "md5_digest": "1fbb48d9ac090936ff569e2906a5ad8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15248, "upload_time": "2017-04-26T12:20:16", "url": "https://files.pythonhosted.org/packages/88/5d/0b215be0999ea3f86885395f8a7453b4e3e30c468a6d9dc38d7b1ad2e921/grappa-http-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4e603f1fb59b094fee791c5144ef9e93", "sha256": "4441dbeb7155d5bd2e43447bd98c9b7a408c2cd33e3841696915eeacd6fc0b67" }, "downloads": -1, "filename": "grappa_http-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4e603f1fb59b094fee791c5144ef9e93", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 27239, "upload_time": "2017-04-26T12:20:20", "url": "https://files.pythonhosted.org/packages/c8/75/e9eedb777a5a662149c4d1bf5ccdc86c1bdbf4c48656d945fddc35e6b6eb/grappa_http-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1fbb48d9ac090936ff569e2906a5ad8e", "sha256": "f08439ca8ecd4fad66b7faa55d831db7655c8abb99927f316873df3432b0d645" }, "downloads": -1, "filename": "grappa-http-0.1.3.tar.gz", "has_sig": false, "md5_digest": "1fbb48d9ac090936ff569e2906a5ad8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15248, "upload_time": "2017-04-26T12:20:16", "url": "https://files.pythonhosted.org/packages/88/5d/0b215be0999ea3f86885395f8a7453b4e3e30c468a6d9dc38d7b1ad2e921/grappa-http-0.1.3.tar.gz" } ] }