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-2.0.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

webtest_asgi-2.0.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file webtest_asgi-2.0.0.tar.gz.

File metadata

  • Download URL: webtest_asgi-2.0.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for webtest_asgi-2.0.0.tar.gz
Algorithm Hash digest
SHA256 086bd9dc602980e67bad9554cec9aa8a21aff783a3f8fdb9637b23d9c598d701
MD5 864432ba0c874cd11f01729d74d382cf
BLAKE2b-256 e6bacd2a5629037a3f0d2414d5ad4a23ebdfb368190d6cdbcfe6965ff1424c9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for webtest_asgi-2.0.0.tar.gz:

Publisher: build-release.yml on sloria/webtest-asgi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file webtest_asgi-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: webtest_asgi-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for webtest_asgi-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 314ada7dc5f096cd3b39c34555bfedd3e0f147aba43dc7d73e90ef38cbf8c26f
MD5 68adf6bc9d29d8e6cc41e28eb1768967
BLAKE2b-256 6070c3f9d7b0c92a847c9d7ba828e000ee479f915bbc2aa8af895bf2c5110300

See more details on using hashes here.

Provenance

The following attestation bundles were made for webtest_asgi-2.0.0-py3-none-any.whl:

Publisher: build-release.yml on sloria/webtest-asgi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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