aboutsummaryrefslogtreecommitdiff
path: root/tests/test_requests_https.py
blob: c6ea8f351ff49bd30d15f05667d8bb98e0e92089 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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()