An extension of WebTest with useful extras, including requests-style authentication.
Project description
An extension of WebTest with useful extras, including requests-style authentication.
Install
$ pip install -U webtest-plus
Usage
import unittest
from myapp import app
from webtest_plus import TestApp
class TestMyApp(unittest.TestCase):
def setUp(self):
self.app = TestApp(app)
def test_protected_endpoint(self):
response = self.app.get("/secret/", expect_errors=True)
assert response.status_code == 401
# Requests-style authentication
response = self.app.get("/secret/", auth=("admin", "passw0rd"))
assert response.status_code == 200
def test_more_secrets(self):
# Another way to authenticate
self.app.authenticate(username="admin", password="passw0rd")
assert self.app.get("/secret/").status_code == 200
self.app.deauthenticate()
assert self.app.get("/secret/", expect_errors=True).status_code == 401
Features
Basic HTTP authentication
Auto-follow redirects
Requirements
Python >= 2.6 or >= 3.3
License
MIT licensed. See the bundled LICENSE file for more details.
Changelog
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.1.0.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for webtest_plus-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8267b4298c2047b345fff079a176a40f91c5702a1931c3ea14359833bb11540 |
|
MD5 | d45d5142901bf4cc0b81705c11f1a8ab |
|
BLAKE2b-256 | 306ec1c1e44e798ab08ed098eee9bc585728bfd747576bf4ed57df2810dce61e |