aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit/utils/test_functest_utils.py
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-08-17 11:39:37 +0000
committerLinda Wang <wangwulin@huawei.com>2017-08-17 11:39:37 +0000
commit3900d3c3efa75e0a382183154c534e67b199152c (patch)
treedebb844e6dc73663415b908aa0f7e199ff635364 /functest/tests/unit/utils/test_functest_utils.py
parentc582427bd2586347fd21bcee3b28a2f7e75faf3d (diff)
Obtain pod_name by CONST instead of get function
JIRA: FUNCTEST-763 Change-Id: Id334745a1eac8b933d77f9cb36a506a02366d760 Signed-off-by: Linda Wang <wangwulin@huawei.com>
Diffstat (limited to 'functest/tests/unit/utils/test_functest_utils.py')
-rw-r--r--functest/tests/unit/utils/test_functest_utils.py26
1 files changed, 3 insertions, 23 deletions
diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py
index b4cc5b73..cd3693c7 100644
--- a/functest/tests/unit/utils/test_functest_utils.py
+++ b/functest/tests/unit/utils/test_functest_utils.py
@@ -150,32 +150,12 @@ class FunctestUtilsTesting(unittest.TestCase):
self.assertEqual(functest_utils.get_version(), "unknown")
@mock.patch('functest.utils.functest_utils.logger.info')
- def test_get_pod_name_failed(self, mock_logger_info):
- with mock.patch.dict(os.environ,
- {},
- clear=True):
- self.assertEqual(functest_utils.get_pod_name(),
- "unknown-pod")
- mock_logger_info.assert_called_once_with("Unable to retrieve "
- "the POD name from "
- "environment. Using "
- "pod name 'unknown-pod'")
-
- def test_get_pod_name_default(self):
- with mock.patch.dict(os.environ,
- {'NODE_NAME': 'test_node_name'},
- clear=True):
- self.assertEqual(functest_utils.get_pod_name(),
- self.node_name)
-
- @mock.patch('functest.utils.functest_utils.logger.info')
def test_logger_test_results(self, mock_logger_info):
CONST.__setattr__('results_test_db_url', self.db_url)
CONST.__setattr__('BUILD_TAG', self.build_tag)
- with mock.patch('functest.utils.functest_utils.get_pod_name',
- return_value=self.node_name), \
- mock.patch('functest.utils.functest_utils.get_scenario',
- return_value=self.scenario), \
+ CONST.__setattr__('NODE_NAME', self.node_name)
+ with mock.patch('functest.utils.functest_utils.get_scenario',
+ return_value=self.scenario), \
mock.patch('functest.utils.functest_utils.get_version',
return_value=self.version):
functest_utils.logger_test_results(self.project, self.case_name,