summaryrefslogtreecommitdiff
path: root/tests/oauth2/rfc6749/test_utils.py
diff options
context:
space:
mode:
authorHsiaoming Yang <me@lepture.com>2013-05-31 17:22:54 +0800
committerHsiaoming Yang <me@lepture.com>2013-05-31 17:22:54 +0800
commit00f5de52a8fb944c968213501ccdf1bbc9e751d0 (patch)
tree2229415d42032ed69d78818454e89db009f9df75 /tests/oauth2/rfc6749/test_utils.py
parent803736c30ed4a426d83daa21216c24163db5e7c6 (diff)
downloadoauthlib-00f5de52a8fb944c968213501ccdf1bbc9e751d0.tar.gz
add test case for is_secure_transport
Diffstat (limited to 'tests/oauth2/rfc6749/test_utils.py')
-rw-r--r--tests/oauth2/rfc6749/test_utils.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/oauth2/rfc6749/test_utils.py b/tests/oauth2/rfc6749/test_utils.py
index 9d25229..6e713a7 100644
--- a/tests/oauth2/rfc6749/test_utils.py
+++ b/tests/oauth2/rfc6749/test_utils.py
@@ -1,7 +1,9 @@
from __future__ import absolute_import, unicode_literals
+import os
from ...unittest import TestCase
from oauthlib.oauth2.rfc6749.utils import escape, host_from_uri
+from oauthlib.oauth2.rfc6749.utils import is_secure_transport
class UtilsTests(TestCase):
@@ -21,3 +23,15 @@ class UtilsTests(TestCase):
self.assertEqual(host_from_uri('https://a.b.com:8080'), ('a.b.com', '8080'))
self.assertEqual(host_from_uri('http://www.example.com'), ('www.example.com', '80'))
self.assertEqual(host_from_uri('https://www.example.com'), ('www.example.com', '443'))
+
+ def test_is_secure_transport(self):
+ """Test check secure uri."""
+ if 'DEBUG' in os.environ:
+ del os.environ['DEBUG']
+
+ self.assertTrue(is_secure_transport('https://example.com'))
+ self.assertFalse(is_secure_transport('http://example.com'))
+
+ os.environ['DEBUG'] = '1'
+ self.assertTrue(is_secure_transport('http://example.com'))
+ del os.environ['DEBUG']