Increase code coverage 03/10103/1
authorSANDEEP KUMAR JAISAWAL <s.jaisawal@samsung.com>
Mon, 12 Dec 2022 16:25:41 +0000 (21:55 +0530)
committerSANDEEP KUMAR JAISAWAL <s.jaisawal@samsung.com>
Mon, 12 Dec 2022 16:27:22 +0000 (21:57 +0530)
Issue-Id: AIMLFW-6

Signed-off-by: SANDEEP KUMAR JAISAWAL <s.jaisawal@samsung.com>
Change-Id: I7dd90b2c0c5679b44377fdadf3e9360296a6abe0

tests/README.MD
tests/test_tm_apis.py

index cc39e6d..6676825 100644 (file)
@@ -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
index 8c84793..df261bc 100644 (file)
@@ -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):