summaryrefslogtreecommitdiffstats
path: root/tests/unit/network_services/vnf_generic
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/network_services/vnf_generic')
-rw-r--r--tests/unit/network_services/vnf_generic/test_vnfdgen.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/unit/network_services/vnf_generic/test_vnfdgen.py b/tests/unit/network_services/vnf_generic/test_vnfdgen.py
index be51e4a43..44d9058dc 100644
--- a/tests/unit/network_services/vnf_generic/test_vnfdgen.py
+++ b/tests/unit/network_services/vnf_generic/test_vnfdgen.py
@@ -193,6 +193,14 @@ class TestVnfdGen(unittest.TestCase):
d = {'a': 1, 'b': 2}
self.assertEqual(vnfdgen.deepgetitem(d, "a"), 1)
+ def test_dict_flatten_str_int_key_first(self):
+ d = {'0': 1, 0: 24, 'b': 2}
+ self.assertEqual(vnfdgen.deepgetitem(d, "0"), 1)
+
+ def test_dict_flatten_int_key_fallback(self):
+ d = {0: 1, 'b': 2}
+ self.assertEqual(vnfdgen.deepgetitem(d, "0"), 1)
+
def test_dict_flatten_list(self):
d = {'a': 1, 'b': list(range(2))}
self.assertEqual(vnfdgen.deepgetitem(d, "b.0"), 0)
@@ -201,6 +209,11 @@ class TestVnfdGen(unittest.TestCase):
d = {'a': 1, 'b': {x: x for x in list(range(2))}}
self.assertEqual(vnfdgen.deepgetitem(d, "b.0"), 0)
+ def test_dict_flatten_only_str_key(self):
+ d = {'0': 1, 0: 24, 'b': 2}
+ self.assertRaises(AttributeError, vnfdgen.deepgetitem, d, 0)
+
+
def test_generate_tp_single_var(self):
""" Function to verify traffic profile generation with imix """