| Total Complexity | 3 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 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 |