From 4374bb94395f28a7902b7d2b801eb1f20dd4e34f Mon Sep 17 00:00:00 2001 From: SANDEEP KUMAR JAISAWAL Date: Mon, 12 Dec 2022 21:55:41 +0530 Subject: [PATCH] Increase code coverage Issue-Id: AIMLFW-6 Signed-off-by: SANDEEP KUMAR JAISAWAL Change-Id: I7dd90b2c0c5679b44377fdadf3e9360296a6abe0 --- tests/README.MD | 8 ++++---- tests/test_tm_apis.py | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/README.MD b/tests/README.MD index cc39e6d..6676825 100644 --- a/tests/README.MD +++ b/tests/README.MD @@ -29,11 +29,11 @@ Install training manager itself as python package pip3 install . ## Install modelmetricsdk and featurestoresdk as python packages -git clone "https://gerrit.o-ran-sc.org/r/aiml-fw/athp/sdk/feature-store" -git clone "https://gerrit.o-ran-sc.org/r/aiml-fw/athp/sdk/model-storage" + git clone "https://gerrit.o-ran-sc.org/r/aiml-fw/athp/sdk/feature-store" /tmp/fssdk/ + git clone "https://gerrit.o-ran-sc.org/r/aiml-fw/athp/sdk/model-storage" /tmp/modelsdk/ -pip3 install feature-store/. -pip3 install model-storage/. + pip3 install /tmp/fssdk/. + pip3 install /tmp/modelsdk/. ## Install all python dependecy packages pip3 install -r requirements_test.txt diff --git a/tests/test_tm_apis.py b/tests/test_tm_apis.py index 8c84793..df261bc 100644 --- a/tests/test_tm_apis.py +++ b/tests/test_tm_apis.py @@ -451,6 +451,18 @@ class Test_get_versions_for_pipeline: the_response.headers={"content-type": "application/json"} the_response._content = b'{"versions_list": ["football", "baseball"]}' + mocked_TRAININGMGR_CONFIG_OBJ=mock.Mock(name="TRAININGMGR_CONFIG_OBJ") + attrs_TRAININGMGR_CONFIG_OBJ = {'kf_adapter_ip.return_value': '123', 'kf_adapter_port.return_value' : '100'} + mocked_TRAININGMGR_CONFIG_OBJ.configure_mock(**attrs_TRAININGMGR_CONFIG_OBJ) + @patch('trainingmgr.trainingmgr_main.TRAININGMGR_CONFIG_OBJ', return_value = mocked_TRAININGMGR_CONFIG_OBJ) + @patch('trainingmgr.trainingmgr_main.requests.get', return_value = the_response) + def test_get_versions_for_pipeline_positive(self,mock1,mock2): + response = self.client.get("/pipelines/{}/versions".format("qoe_pipeline")) + trainingmgr_main.LOGGER.debug(response.data) + assert response.content_type == "application/json", "not equal content type" + assert response.status_code == 200, "Return status code NOT equal" + + @patch('trainingmgr.trainingmgr_main.requests.get', return_value = the_response) def test_get_versions_for_pipeline(self,mock1): -- 2.16.6