From 85b59444d7c9008afb7b9fe82fdbf315e4baffc8 Mon Sep 17 00:00:00 2001 From: Theron Luhn Date: Thu, 26 Apr 2018 16:12:06 -0700 Subject: Documentation bearer token and JWT authorization --- docs/testapp.rst | 9 ++++++++- webtest/app.py | 8 ++++++-- 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 """ -- cgit v1.2.1