Skip to main content

webtest-sanic provides integration of WebTest with sanic applications

Project description

webtest-sanic

Integration of WebTest with Sanic applications Initially it was created to enable Sanic support in Webargs module

Build Status Latest Version Python Versions Tests Coverage Downloads

Example Code

    import asyncio

    from sanic import Sanic
    from sanic.response import json
    from webtest_sanic import TestApp

    app = Sanic()

    @app.route('/')
    async def test(request):
        return json({'hello': 'world'})

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

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

Installing

It is easy to do from pip

pip install webstat-sanic

or from sources

git clone git@github.com:EndurantDevs/webstat-sanic.git
cd webstat-sanic
python setup.py install

Running the tests

To be sure everything is fine before installation from sources, just run:

python setup.py test

Or

pytest tests/

Credits

This code is based on webtest-aiohttp by Steven Loria and pytest-sanic by Yun Xu Please check NOTICE for more info.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

webtest_sanic-0.1-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

Details for the file webtest_sanic-0.1-py3-none-any.whl.

File metadata

  • Download URL: webtest_sanic-0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for webtest_sanic-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 04ee016dc06bce5ce400d66d96c43580ac7b709a21ee62a6aee0bd91fd05e87b
MD5 59941546f2d4f3338f3035b3dbd47789
BLAKE2b-256 ae575953054c0041bd0910dd18523d63241b7bfca5a834b52bc7b0b356a98eb7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page