Bug 1962 fixed: removed the variable cluster_uuid from init_env method
[osm/N2VC.git] / n2vc / tests / unit / test_k8s_helm3_conn.py
index 4f5247b..9ae5a72 100644 (file)
@@ -39,7 +39,7 @@ class TestK8sHelm3Conn(asynctest.TestCase):
         self.fs.path = "./tmp/"
         self.namespace = "testk8s"
         self.cluster_id = "helm3_cluster_id"
-        self.cluster_uuid = "{}:{}".format(self.namespace, self.cluster_id)
+        self.cluster_uuid = self.cluster_id
         # pass fake kubectl and helm commands to make sure it does not call actual commands
         K8sHelm3Connector._check_file_exists = asynctest.Mock(return_value=True)
         cluster_dir = self.fs.path + self.cluster_id
@@ -66,8 +66,8 @@ class TestK8sHelm3Conn(asynctest.TestCase):
 
         self.assertEqual(
             k8scluster_uuid,
-            "{}:{}".format(self.namespace, self.cluster_id),
-            "Check cluster_uuid format: <namespace>.<cluster_id>",
+            self.cluster_id,
+            "Check cluster_uuid",
         )
         self.helm_conn._get_namespaces.assert_called_once_with(self.cluster_id)
         self.helm_conn._create_namespace.assert_called_once_with(
@@ -651,6 +651,7 @@ class TestK8sHelm3Conn(asynctest.TestCase):
                 "updated": "2020-10-30 11:11:20.376744191 +0000 UTC",
             }
         ]
+        self.helm_conn._get_namespace = Mock(return_value=self.namespace)
         self.helm_conn._uninstall_sw = asynctest.CoroutineMock()
         self.helm_conn.instances_list = asynctest.CoroutineMock(return_value=instances)
         self.helm_conn.uninstall = asynctest.CoroutineMock()
@@ -660,6 +661,9 @@ class TestK8sHelm3Conn(asynctest.TestCase):
         self.helm_conn.fs.file_delete.assert_called_once_with(
             self.cluster_id, ignore_non_exist=True
         )
+        self.helm_conn._get_namespace.assert_called_once_with(
+            cluster_uuid=self.cluster_uuid
+        )
         self.helm_conn.instances_list.assert_called_once_with(
             cluster_uuid=self.cluster_uuid
         )
@@ -667,7 +671,7 @@ class TestK8sHelm3Conn(asynctest.TestCase):
             cluster_uuid=self.cluster_uuid, kdu_instance=kdu_instance
         )
         self.helm_conn._uninstall_sw.assert_called_once_with(
-            self.cluster_id, self.namespace
+            cluster_id=self.cluster_id, namespace=self.namespace
         )
 
     @asynctest.fail_on(active_handles=True)