diff --git a/CHANGELOG b/CHANGELOG index 47120380..1b8873e8 100755 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,11 @@ # Changelog +## v2.3.1 + +### Bug fixes + +- Overriding deployed models. + ## v2.3.0 ### Improvements diff --git a/tabpy/VERSION b/tabpy/VERSION index cc6612c3..a6254504 100755 --- a/tabpy/VERSION +++ b/tabpy/VERSION @@ -1 +1 @@ -2.3.0 \ No newline at end of file +2.3.1 \ No newline at end of file diff --git a/tabpy/tabpy_server/handlers/base_handler.py b/tabpy/tabpy_server/handlers/base_handler.py index ecffa499..26a86916 100644 --- a/tabpy/tabpy_server/handlers/base_handler.py +++ b/tabpy/tabpy_server/handlers/base_handler.py @@ -145,7 +145,6 @@ def error_out(self, code, log_message, info=None): code, log_message, info ), ) - self.finish() def options(self): # add CORS headers if TabPy has a cors_origin specified diff --git a/tabpy/tabpy_server/management/state.py b/tabpy/tabpy_server/management/state.py index 424d3b16..12a5052b 100644 --- a/tabpy/tabpy_server/management/state.py +++ b/tabpy/tabpy_server/management/state.py @@ -174,9 +174,9 @@ def _check_and_set_endpoint_type(self, endpoint_type, defaultValue): return self._check_and_set_endpoint_str_value( endpoint_type, "endpoint type", defaultValue) - def _check_and_set_target(self, target, defaultValue): - return self._check_and_set_endpoint_str_value( - target, "target", defaultValue) + def _check_target(self, target): + if target and not isinstance(target, str): + raise ValueError("target must be a string.") def _check_and_set_dependencies(self, dependencies, defaultValue): if not dependencies: @@ -232,7 +232,7 @@ def add_endpoint( endpoint_type = self._check_and_set_endpoint_type(endpoint_type, None) dependencies = self._check_and_set_dependencies(dependencies, []) - target = self._check_and_set_target(target, "") + self._check_target(target) if target and target not in endpoints: raise ValueError("target endpoint is not valid.") @@ -331,7 +331,7 @@ def update_endpoint( dependencies = self._check_and_set_dependencies( dependencies, endpoint_info.get("dependencies", [])) - target = self._check_and_set_target(target, None) + self._check_target(target) if target and target not in endpoints: raise ValueError("target endpoint is not valid.") elif not target: diff --git a/tests/integration/test_deploy_model_ssl_on_auth_on.py b/tests/integration/test_deploy_model_ssl_on_auth_on.py index af141b72..037f6de6 100644 --- a/tests/integration/test_deploy_model_ssl_on_auth_on.py +++ b/tests/integration/test_deploy_model_ssl_on_auth_on.py @@ -45,3 +45,36 @@ def test_deploy_ssl_on_auth_on(self): headers=headers, ) self.assertEqual(200, m_response.status_code) + + def test_override_model_ssl_on_auth_on(self): + # Uncomment the following line to preserve + # test case output and other files (config, state, ect.) + # in system temp folder. + # self.set_delete_temp_folder(False) + + self.deploy_models(self._get_username(), self._get_password()) + + # Override models + self.deploy_models(self._get_username(), self._get_password()) + + headers = { + "Content-Type": "application/json", + "TabPy-Client": "Integration test for deploying models with auth", + "Authorization": "Basic " + + base64.b64encode("user1:P@ssw0rd".encode("utf-8")).decode("utf-8"), + } + + session = requests.Session() + # Do not verify servers' cert to be signed by trusted CA + session.verify = False + # Do not warn about insecure request + requests.packages.urllib3.disable_warnings() + + models = ["PCA", "Sentiment%20Analysis", "ttest", "anova"] + for m in models: + m_response = session.get( + url=f"{self._get_transfer_protocol()}://" + f"localhost:9004/endpoints/{m}", + headers=headers, + ) + self.assertEqual(200, m_response.status_code)