tests.integration.test_deploy_model_ssl_on_auth_off   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 20
dl 0
loc 31
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A TestDeployModelSSLOnAuthOff.test_deploy_ssl_on_auth_off() 0 16 2
A TestDeployModelSSLOnAuthOff._get_key_file_name() 0 2 1
A TestDeployModelSSLOnAuthOff._get_transfer_protocol() 0 2 1
A TestDeployModelSSLOnAuthOff._get_certificate_file_name() 0 2 1
1
from . import integ_test_base
2
import requests
3
4
5
class TestDeployModelSSLOnAuthOff(integ_test_base.IntegTestBase):
6
    def _get_transfer_protocol(self) -> str:
7
        return "https"
8
9
    def _get_certificate_file_name(self) -> str:
10
        return "./tests/integration/resources/2019_04_24_to_3018_08_25.crt"
11
12
    def _get_key_file_name(self) -> str:
13
        return "./tests/integration/resources/2019_04_24_to_3018_08_25.key"
14
15
    def test_deploy_ssl_on_auth_off(self):
16
        self.deploy_models(self._get_username(), self._get_password())
17
18
        session = requests.Session()
19
        # Do not verify servers' cert to be signed by trusted CA
20
        session.verify = False
21
        # Do not warn about insecure request
22
        requests.packages.urllib3.disable_warnings()
23
24
        models = ["PCA", "Sentiment%20Analysis", "ttest", "anova"]
25
        for m in models:
26
            m_response = session.get(
27
                url=f"{self._get_transfer_protocol()}://"
28
                f"localhost:9004/endpoints/{m}"
29
            )
30
            self.assertEqual(200, m_response.status_code)
31