tests.integration.test_url_ssl   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 18
dl 0
loc 32
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A TestURL_SSL._get_port() 0 2 1
A TestURL_SSL._get_key_file_name() 0 2 1
A TestURL_SSL.test_notexistent_url() 0 9 1
A TestURL_SSL._get_certificate_file_name() 0 2 1
A TestURL_SSL._get_transfer_protocol() 0 2 1
1
"""
2
All other misc. URL-related integration tests for
3
when SSL is turned on for TabPy.
4
"""
5
6
from . import integ_test_base
7
import requests
8
9
10
class TestURL_SSL(integ_test_base.IntegTestBase):
11
    def _get_port(self):
12
        return "9005"
13
14
    def _get_transfer_protocol(self) -> str:
15
        return "https"
16
17
    def _get_certificate_file_name(self) -> str:
18
        return "./tests/integration/resources/2019_04_24_to_3018_08_25.crt"
19
20
    def _get_key_file_name(self) -> str:
21
        return "./tests/integration/resources/2019_04_24_to_3018_08_25.key"
22
23
    def test_notexistent_url(self):
24
        session = requests.Session()
25
        # Do not verify servers' cert to be signed by trusted CA
26
        session.verify = False
27
        # Do not warn about insecure request
28
        requests.packages.urllib3.disable_warnings()
29
        response = session.get(url=f"https://localhost:{self._get_port()}/unicorn")
30
31
        self.assertEqual(404, response.status_code)
32