diff options
author | Jonathan Huot <JonathanHuot@users.noreply.github.com> | 2019-04-26 22:44:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-26 22:44:19 +0200 |
commit | f1b8781e9f9dbce18ba67bbdf8f122109c5650d3 (patch) | |
tree | d197a477345dfeb34df0afe34e3640c815b033e1 /tests | |
parent | 91a2792da6e968fa72d871b2f0b95a8734f40546 (diff) | |
parent | 30321dd3c0ca784d3508a1970cf90d9f76835c79 (diff) | |
download | oauthlib-f1b8781e9f9dbce18ba67bbdf8f122109c5650d3.tar.gz |
Merge branch 'master' into oidc-hashes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/__init__.py | 3 | ||||
-rw-r--r-- | tests/test_common.py | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/__init__.py b/tests/__init__.py index e69de29..f33236b 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,3 @@ +import oauthlib + +oauthlib.set_debug(True) diff --git a/tests/test_common.py b/tests/test_common.py index 20d9f5b..ae2531b 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -1,8 +1,10 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals +import os import sys +import oauthlib from oauthlib.common import (CaseInsensitiveDict, Request, add_params_to_uri, extract_params, generate_client_id, generate_nonce, generate_timestamp, @@ -214,6 +216,20 @@ class RequestTest(TestCase): self.assertEqual(r.headers['token'], 'foobar') self.assertEqual(r.token, 'banana') + def test_sanitized_request_non_debug_mode(self): + """make sure requests are sanitized when in non debug mode. + For the debug mode, the other tests checking sanitization should prove + that debug mode is working. + """ + try: + oauthlib.set_debug(False) + r = Request(URI, headers={'token': 'foobar'}, body='token=banana') + self.assertNotIn('token', repr(r)) + self.assertIn('SANITIZED', repr(r)) + finally: + # set flag back for other tests + oauthlib.set_debug(True) + class CaseInsensitiveDictTest(TestCase): |