webtest-aiohttp


Namewebtest-aiohttp JSON
Version 2.0.0 PyPI version JSON
download
home_pagehttps://github.com/sloria/webtest-aiohttp
Summarywebtest-aiohttp provides integration of WebTest with aiohttp.web applications
upload_time2018-02-08 04:17:36
maintainer
docs_urlNone
authorSteven Loria
requires_python
licenseMIT
keywords webtest-aiohttp webtest aiohttp testing wsgi asyncio
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            ***************
webtest-aiohttp
***************

.. image:: https://badge.fury.io/py/webtest-aiohttp.svg
    :target: http://badge.fury.io/py/webtest-aiohttp
    :alt: Latest version

.. image:: https://travis-ci.org/sloria/webtest-aiohttp.svg
    :target: https://travis-ci.org/sloria/webtest-aiohttp
    :alt: Travis-CI

webtest-aiohttp provides integration of WebTest with aiohttp.web applications.

Supports aiohttp>=2.3.8.

.. code-block:: python

    from aiohttp import web
    from webtest_aiohttp import TestApp

    app = web.Application()

    async def hello(request):
        return web.json_response({'message': 'Hello world'})

    app.router.add_route('GET', '/', handler)

    def test_hello(loop):
        client = TestApp(app, loop=loop)
        res = client.get('/')
        assert res.status_code == 200
        assert res.json == {'message': 'Hello world'}

Installation
============
::

    pip install webtest-aiohttp


**Note: If you are using aiohttp<2.0.0, you will need to install webtest-aiohttp 1.x.**

::

    pip install 'webtest-aiohttp<2.0.0'


Usage with pytest
=================

If you are using pytest and pytest-aiohttp, you can make your tests more
concise with a fixture.


.. code-block:: python

    from aiohttp import web
    from webtest_aiohttp import TestApp as WebTestApp

    app = web.Application()

    async def hello(request):
        return web.json_response({'message': 'Hello world'})

    app.router.add_route('GET', '/', handler)

    @pytest.fixture()
    def testapp(loop):
        return WebTestApp(app, loop=loop)

    def test_get(testapp):
        assert testapp.get('/').json == {'message': 'Hello world'}

Project Links
=============

- PyPI: https://pypi.python.org/pypi/webtest-aiohttp
- Issues: https://github.com/sloria/webtest-aiohttp/issues

License
=======

MIT licensed. See the bundled `LICENSE <https://github.com/sloria/webtest-aiohttp/blob/master/LICENSE>`_ file for more details.



            

Raw data

            {
    "maintainer": "", 
    "docs_url": null, 
    "requires_python": "", 
    "maintainer_email": "", 
    "cheesecake_code_kwalitee_id": null, 
    "keywords": "webtest-aiohttp webtest aiohttp testing wsgi asyncio", 
    "upload_time": "2018-02-08 04:17:36", 
    "author": "Steven Loria", 
    "home_page": "https://github.com/sloria/webtest-aiohttp", 
    "github_user": "sloria", 
    "download_url": "https://pypi.python.org/packages/1f/46/9c3f326522b83253b7156007c96977d6bb5fcf78b1dcb1da1b928ab876b8/webtest-aiohttp-2.0.0.tar.gz", 
    "platform": "", 
    "version": "2.0.0", 
    "cheesecake_documentation_id": null, 
    "description": "***************\nwebtest-aiohttp\n***************\n\n.. image:: https://badge.fury.io/py/webtest-aiohttp.svg\n    :target: http://badge.fury.io/py/webtest-aiohttp\n    :alt: Latest version\n\n.. image:: https://travis-ci.org/sloria/webtest-aiohttp.svg\n    :target: https://travis-ci.org/sloria/webtest-aiohttp\n    :alt: Travis-CI\n\nwebtest-aiohttp provides integration of WebTest with aiohttp.web applications.\n\nSupports aiohttp>=2.3.8.\n\n.. code-block:: python\n\n    from aiohttp import web\n    from webtest_aiohttp import TestApp\n\n    app = web.Application()\n\n    async def hello(request):\n        return web.json_response({'message': 'Hello world'})\n\n    app.router.add_route('GET', '/', handler)\n\n    def test_hello(loop):\n        client = TestApp(app, loop=loop)\n        res = client.get('/')\n        assert res.status_code == 200\n        assert res.json == {'message': 'Hello world'}\n\nInstallation\n============\n::\n\n    pip install webtest-aiohttp\n\n\n**Note: If you are using aiohttp<2.0.0, you will need to install webtest-aiohttp 1.x.**\n\n::\n\n    pip install 'webtest-aiohttp<2.0.0'\n\n\nUsage with pytest\n=================\n\nIf you are using pytest and pytest-aiohttp, you can make your tests more\nconcise with a fixture.\n\n\n.. code-block:: python\n\n    from aiohttp import web\n    from webtest_aiohttp import TestApp as WebTestApp\n\n    app = web.Application()\n\n    async def hello(request):\n        return web.json_response({'message': 'Hello world'})\n\n    app.router.add_route('GET', '/', handler)\n\n    @pytest.fixture()\n    def testapp(loop):\n        return WebTestApp(app, loop=loop)\n\n    def test_get(testapp):\n        assert testapp.get('/').json == {'message': 'Hello world'}\n\nProject Links\n=============\n\n- PyPI: https://pypi.python.org/pypi/webtest-aiohttp\n- Issues: https://github.com/sloria/webtest-aiohttp/issues\n\nLicense\n=======\n\nMIT licensed. See the bundled `LICENSE <https://github.com/sloria/webtest-aiohttp/blob/master/LICENSE>`_ file for more details.\n\n\n", 
    "tox": true, 
    "lcname": "webtest-aiohttp", 
    "bugtrack_url": null, 
    "github": true, 
    "coveralls": false, 
    "name": "webtest-aiohttp", 
    "license": "MIT", 
    "travis_ci": true, 
    "github_project": "webtest-aiohttp", 
    "summary": "webtest-aiohttp provides integration of WebTest with aiohttp.web applications", 
    "split_keywords": [
        "webtest-aiohttp", 
        "webtest", 
        "aiohttp", 
        "testing", 
        "wsgi", 
        "asyncio"
    ], 
    "author_email": "sloria1@gmail.com", 
    "urls": [
        {
            "has_sig": false, 
            "upload_time": "2018-02-08T04:17:36", 
            "comment_text": "", 
            "python_version": "source", 
            "url": "https://pypi.python.org/packages/1f/46/9c3f326522b83253b7156007c96977d6bb5fcf78b1dcb1da1b928ab876b8/webtest-aiohttp-2.0.0.tar.gz", 
            "md5_digest": "768c20c45e4f29c07c131cf5a93a9ebe", 
            "downloads": 0, 
            "filename": "webtest-aiohttp-2.0.0.tar.gz", 
            "packagetype": "sdist", 
            "path": "1f/46/9c3f326522b83253b7156007c96977d6bb5fcf78b1dcb1da1b928ab876b8/webtest-aiohttp-2.0.0.tar.gz", 
            "size": 8365
        }, 
        {
            "has_sig": false, 
            "upload_time": "2018-02-08T04:17:35", 
            "comment_text": "", 
            "python_version": "py2.py3", 
            "url": "https://pypi.python.org/packages/f4/64/6ac160e44859602962495e0d52ef8bac1e244c48365b38d7424d2dc70222/webtest_aiohttp-2.0.0-py2.py3-none-any.whl", 
            "md5_digest": "b1578608c5c2c9a436de3e375c2260cf", 
            "downloads": 0, 
            "filename": "webtest_aiohttp-2.0.0-py2.py3-none-any.whl", 
            "packagetype": "bdist_wheel", 
            "path": "f4/64/6ac160e44859602962495e0d52ef8bac1e244c48365b38d7424d2dc70222/webtest_aiohttp-2.0.0-py2.py3-none-any.whl", 
            "size": 4773
        }
    ], 
    "_id": null, 
    "cheesecake_installability_id": null
}