summaryrefslogtreecommitdiff
path: root/tests/test_common.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_common.py')
-rw-r--r--tests/test_common.py16
1 files changed, 16 insertions, 0 deletions
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):