Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

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

Project Description

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

import asyncio

from aiohttp import web
from webtest_aiohttp import TestApp

loop = asyncio.get_event_loop()
asyncio.set_event_loop(loop)

app = web.Application(loop=loop)

@asyncio.coroutine
def hello(request):
    return web.Response(body=json.dumps(
        {'message': 'Hello world'}
    ).encode('utf-8'), content_type='application/json')

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


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

Installation

pip install webtest-aiohttp

Credits

This code was adapted from Kirill Klenov’s muffin library.

License

MIT licensed. See the bundled LICENSE file for more details.

Release History

This version
History Node

1.0.0.dev0

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
webtest_aiohttp-1.0.0.dev0-py2.py3-none-any.whl
(6.1 kB) Copy SHA256 Hash SHA256
py2.py3 Wheel Oct 20, 2015
webtest-aiohttp-1.0.0.dev0.tar.gz
(4.0 kB) Copy SHA256 Hash SHA256
Source Oct 20, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting