external tests
authorKenneth Reitz <me@kennethreitz.com>
Wed, 28 Dec 2011 08:01:00 +0000 (03:01 -0500)
committerKenneth Reitz <me@kennethreitz.com>
Wed, 28 Dec 2011 08:01:00 +0000 (03:01 -0500)
test_requests_ext.py [new file with mode: 0644]

diff --git a/test_requests_ext.py b/test_requests_ext.py
new file mode 100644 (file)
index 0000000..8c4b777
--- /dev/null
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from __future__ import with_statement
+
+import unittest
+
+import requests
+
+try:
+    import omnijson as json
+except ImportError:
+    import json
+
+
+class RequestsTestSuite(unittest.TestCase):
+    """Requests test cases."""
+
+    # It goes to eleven.
+    _multiprocess_can_split_ = True
+
+    def test_addition(self):
+        assert (1 + 1) == 2
+
+    def test_ssl_hostname_ok(self):
+        requests.get('https://github.com', verify=True)
+
+    def test_ssl_hostname_not_ok(self):
+        requests.get('https://kennethreitz.com', verify=False)
+
+        self.assertRaises(requests.exceptions.SSLError, requests.get, 'https://kennethreitz.com', verify=True)
+
+    def test_ssl_hostname_session_not_ok(self):
+
+        s = requests.session(verify=True)
+
+        s.get('https://kennethreitz.com', verify=False)
+
+        self.assertRaises(requests.exceptions.SSLError, s.get, 'https://kennethreitz.com')
+
+
+
+if __name__ == '__main__':
+    unittest.main()
+