Skip to main content

An extension of WebTest with useful extras, including requests-style authentication.

Project description

An extension of WebTest with useful extras, including requests-style authentication.


$ pip install -U webtest-plus


import unittest
from myapp import app
from webtest_plus import TestApp

class TestMyApp(unittest.TestCase):

    def setUp(self): = TestApp(app)

    def test_protected_endpoint(self):
        response ="/secret/", expect_errors=True)
        assert response.status_code == 401
        # Requests-style authentication
        response ="/secret/", auth=("admin", "passw0rd"))
        assert response.status_code == 200

    def test_more_secrets(self):
        # Another way to authenticate"admin", password="passw0rd")
        assert"/secret/").status_code == 200
        assert"/secret/", expect_errors=True).status_code == 401

    def test_posting_json(self):
        # Testing json requests and responses
        response ="/postsecret/", {"secret": "myprecious"},
                                        auth=("admin", "passw0rd"))
        assert response.request.content_type == "application/json"


  • Basic HTTP authentication

  • Auto-follow redirects

  • Framework-agnostic


  • Python >= 2.6 or >= 3.3


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


0.2.0 (2013-10-15)

  • Add support for JSON methods (e.g. app.post_json, etc.)

0.1.0 (2013-10-06)

  • First release.

  • HTTP Basic Authentication working.

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-plus-0.2.0.tar.gz (5.7 kB view hashes)

Uploaded source

Built Distribution

webtest_plus-0.2.0-py2.py3-none-any.whl (7.2 kB view hashes)

Uploaded 2 7

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page