Test Failed
Push — master ( b526e1...71c790 )
by
unknown
08:59 queued 01:38
created

tests.integration.test_deploy_and_evaluate_model_auth_on   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 19
dl 0
loc 35
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A TestDeployAndEvaluateModelAuthOn.test_deploy_and_evaluate_model() 0 24 1
A TestDeployAndEvaluateModelAuthOn._get_port() 0 2 1
A TestDeployAndEvaluateModelAuthOn._get_config_file_name() 0 2 1
1
from . import integ_test_base
2
3
4
class TestDeployAndEvaluateModelAuthOn(integ_test_base.IntegTestBase):
5
    def _get_config_file_name(self) -> str:
6
        return "./tests/integration/resources/deploy_and_evaluate_model_auth.conf"
7
8
    def _get_port(self) -> str:
9
        return "9009"
10
11
    def test_deploy_and_evaluate_model(self):
12
        # Uncomment the following line to preserve
13
        # test case output and other files (config, state, ect.)
14
        # in system temp folder.
15
        # self.set_delete_temp_folder(False)
16
17
        self.deploy_models(self._get_username(), self._get_password())
18
19
        headers = {
20
            "Content-Type": "application/json",
21
            "Authorization": "Basic dXNlcjE6UEBzc3cwcmQ=",
22
            "Host": "localhost:9009",
23
        }
24
        payload = """{
25
                "data": { "_arg1": ["happy", "sad", "neutral"] },
26
                "script":
27
                "return tabpy.query('Sentiment Analysis',_arg1)['response']"
28
            }"""
29
30
        conn = self._get_connection()
31
        conn.request("POST", "/evaluate", payload, headers)
32
        SentimentAnalysis_eval = conn.getresponse()
33
        self.assertEqual(200, SentimentAnalysis_eval.status)
34
        SentimentAnalysis_eval.read()
35