summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGael Pasgrimaud <gael@gawel.org>2018-04-27 10:02:47 +0200
committerGitHub <noreply@github.com>2018-04-27 10:02:47 +0200
commit4e29ce304e2295e6c68b2974945b1dc5aa0bc6d3 (patch)
treee02342c52b803bb70ce73194f878e1153e9cf3df
parent1084623064bdf6bf305467e2500db0b4413ec507 (diff)
parent85b59444d7c9008afb7b9fe82fdbf315e4baffc8 (diff)
downloadwebtest-4e29ce304e2295e6c68b2974945b1dc5aa0bc6d3.tar.gz
Merge pull request #191 from luhn/patch-1
Documentation bearer token and JWT authorization
-rw-r--r--docs/testapp.rst9
-rw-r--r--webtest/app.py8
2 files changed, 14 insertions, 3 deletions
diff --git a/docs/testapp.rst b/docs/testapp.rst
index 430d0a9..911daca 100644
--- a/docs/testapp.rst
+++ b/docs/testapp.rst
@@ -105,7 +105,14 @@ dictionary:
app = TestApp(my_app)
app.authorization = ('Basic', ('user', 'password'))
-Only Basic auth is supported for now.
+You can also use bearer token or JWT authorization types:
+
+.. code-block:: python
+
+ app = TestApp(my_app)
+ app.authorization = ('Bearer', 'mytoken')
+ # or
+ app.authorization = ('JWT', 'myjwt')
Testing a non wsgi application
------------------------------
diff --git a/webtest/app.py b/webtest/app.py
index 1c19e94..5b7a3e5 100644
--- a/webtest/app.py
+++ b/webtest/app.py
@@ -184,8 +184,12 @@ class TestApp(object):
self.JSONEncoder = json_encoder
def get_authorization(self):
- """Allow to set the HTTP_AUTHORIZATION environ key. Value should looks
- like ``('Basic', ('user', 'password'))``
+ """Allow to set the HTTP_AUTHORIZATION environ key. Value should look
+ like one of the following:
+
+ * ``('Basic', ('user', 'password'))``
+ * ``('Bearer', 'mytoken')``
+ * ``('JWT', 'myjwt')``
If value is None the the HTTP_AUTHORIZATION is removed
"""