test_requests_ext.py
This file
Path
test_requests_ext.py
45 lines · 963 bytes · Python
Last changed by
Merge branch 'develop' of github.com:kennethreitz/requests into developKenneth Reitzbefore adoption6db255d
History of this fileTake it
external testsKenneth Reitzbefore adoptiona1afbfb
lines 1–30why, one step back1#!/usr/bin/env python2# -*- coding: utf-8 -*-34from __future__ import with_statement56import unittest78import requests910try:11 import omnijson as json12except ImportError:13 import json141516class RequestsTestSuite(unittest.TestCase):17 """Requests test cases."""1819 # It goes to eleven.20 _multiprocess_can_split_ = True2122 def test_addition(self):23 assert (1 + 1) == 22425 def test_ssl_hostname_ok(self):26 requests.get('https://github.com', verify=True)2728 def test_ssl_hostname_not_ok(self):29 requests.get('https://kennethreitz.com', verify=False)30ch ch changesKenneth Reitzbefore adoption9c0a0fb
line 31why, one step back31 self.assertRaises(requests.exceptions.SSLError, requests.get, 'https://kennethreitz.com')external testsKenneth Reitzbefore adoptiona1afbfb
lines 32–34why, one step back3233 def test_ssl_hostname_session_not_ok(self):34ch ch changesKenneth Reitzbefore adoption9c0a0fb
line 35why, one step back35 s = requests.session()external testsKenneth Reitzbefore adoptiona1afbfb
lines 36–37why, one step back3637 self.assertRaises(requests.exceptions.SSLError, s.get, 'https://kennethreitz.com')Merge branch 'develop' of github.com:kennethreitz/requests into developKenneth Reitzbefore adoption6db255d
lines 38–39why, one step back3839 s.get('https://kennethreitz.com', verify=False)external testsKenneth Reitzbefore adoptiona1afbfb
lines 40–45why, one step back40414243if __name__ == '__main__':44 unittest.main()45