Skip to main content

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

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.new_event_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 webtest-sanic

or from sources

git clone git@github.com:EndurantDevs/webtest-sanic.git
cd webtest-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.

Metadata

Release files for webtest-sanic 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for webtest-sanic 0.4.2
File Interpreter ABI Platform
webtest_sanic-0.4.2-py3-none-any.whl Python 3 none any Details

Release files / webtest_sanic-0.4.2-py3-none-any.whl

Download URL webtest_sanic-0.4.2-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46fd541f64ec9b6b03536ab83c5b645c36b6222fc93399b5da2e562efc55f427
BLAKE2b-256 checksum
How to use checksums
c28ea3a25ed6225b651ec627847632db8ab0098b407777a9c49aec0f119864c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.4

Release history Release notifications | RSS feed

This release

0.4.2 This release

1 release file

0.4.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page