summaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/core
diff options
context:
space:
mode:
authorJing Lu <lvjing5@huawei.com>2017-02-16 09:36:46 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-02-16 09:36:46 +0000
commit67b8280f53646fb268bc1e2fbe166173419bbd88 (patch)
treeb1b72060729ed180fe24b9e3491961b3fb71cb28 /tests/unit/benchmark/core
parentdd8ca59fd7421a1f362e50f0d3413a903761d179 (diff)
parentcc3f02db3c337ba441c69f8f852566b7f402e850 (diff)
Merge "Bugfix: AttributeError: 'dict' object has no attribute 'encode'"
Diffstat (limited to 'tests/unit/benchmark/core')
-rw-r--r--tests/unit/benchmark/core/test_task.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/unit/benchmark/core/test_task.py b/tests/unit/benchmark/core/test_task.py
index c56e21047..cd7ffdebb 100644
--- a/tests/unit/benchmark/core/test_task.py
+++ b/tests/unit/benchmark/core/test_task.py
@@ -155,6 +155,30 @@ class TaskTestCase(unittest.TestCase):
self.assertEqual(task_args_fnames[0], None)
self.assertEqual(task_args_fnames[1], None)
+ def test_change_server_name_host_str(self):
+ scenario = {'host': 'demo'}
+ suffix = '-8'
+ task.change_server_name(scenario, suffix)
+ self.assertTrue(scenario['host'], 'demo-8')
+
+ def test_change_server_name_host_dict(self):
+ scenario = {'host': {'name': 'demo'}}
+ suffix = '-8'
+ task.change_server_name(scenario, suffix)
+ self.assertTrue(scenario['host']['name'], 'demo-8')
+
+ def test_change_server_name_target_str(self):
+ scenario = {'target': 'demo'}
+ suffix = '-8'
+ task.change_server_name(scenario, suffix)
+ self.assertTrue(scenario['target'], 'demo-8')
+
+ def test_change_server_name_target_dict(self):
+ scenario = {'target': {'name': 'demo'}}
+ suffix = '-8'
+ task.change_server_name(scenario, suffix)
+ self.assertTrue(scenario['target']['name'], 'demo-8')
+
def _get_file_abspath(self, filename):
curr_path = os.path.dirname(os.path.abspath(__file__))
file_path = os.path.join(curr_path, filename)