Skip to main content

webtest-asgi provides integration of WebTest with ASGI applications

Project description

pypi badge travis-ci status Code style: Black

webtest-asgi provides integration of WebTest with ASGI applications.

Disclaimer

You should probably use Starlette’s TestClient instead of this package for testing ASGI applications. This package was created to test webargs-starlette using webargs’ CommonTestCase, which uses WebTest to test common functionality across multiple web frameworks.

Installation

pip install webtest-asgi

Usage

You can use webtest-asgi with any ASGI application. Here is example usage with Starlette.

from starlette.applications import Starlette
from starlette.responses import JSONResponse
from webtest_asgi import TestApp as WebTestApp

app = Starlette()


@app.route("/")
async def homepage(request):
    return JSONResponse({"hello": "world"})


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


def test_get_homepage(testapp):
    assert testapp.get("/").json == {"hello": "world"}

License

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

Project details


Download files

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

Source Distribution

webtest-asgi-1.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

webtest_asgi-1.1.0-py2.py3-none-any.whl (3.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file webtest-asgi-1.1.0.tar.gz.

File metadata

  • Download URL: webtest-asgi-1.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.0

File hashes

Hashes for webtest-asgi-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7fd0500e4526bb4b90816f84a17094cfd29482c148873da4243b953b9ab187e1
MD5 46ecde512290cea7c6a0b84e9c99c9e5
BLAKE2b-256 9c8e8e433d19969714853240173cbba717f7d34a2b221f1e01b167520eacfe89

See more details on using hashes here.

Provenance

File details

Details for the file webtest_asgi-1.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for webtest_asgi-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c550fdaed0e349395389ba990a7d445fe307d116f4cd2e96a9378026825350fe
MD5 5cfa61751bf157f835d530eee9742861
BLAKE2b-256 2b78432e9dd2f7f0f748c2edf9572c9a0c890b3dae37bd429c8a7c7400cf968f

See more details on using hashes here.

Provenance

Supported by

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