mirror of
https://github.com/kennethreitz/requests3.git
synced 2026-06-05 23:10:16 +00:00
Add a smoke test for https functionality
This commit is contained in:
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys, os
|
||||
import json
|
||||
import unittest
|
||||
|
||||
# Path hack.
|
||||
sys.path.insert(0, os.path.abspath('..'))
|
||||
import requests
|
||||
|
||||
class HTTPSTest(unittest.TestCase):
|
||||
"""Smoke test for https functionality."""
|
||||
|
||||
smoke_url = "https://github.com"
|
||||
|
||||
def perform_smoke_test(self, verify=False):
|
||||
result = requests.get(self.smoke_url, verify=verify)
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_smoke(self):
|
||||
"""Smoke test without verification."""
|
||||
self.perform_smoke_test(verify=False)
|
||||
|
||||
def test_smoke_verified(self):
|
||||
"""Smoke test with SSL verification."""
|
||||
self.perform_smoke_test(verify=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user