summaryrefslogtreecommitdiffstats
path: root/vio
diff options
context:
space:
mode:
authorEthan Lynn <ethanlynnl@vmware.com>2018-06-13 14:00:47 +0800
committerEthan Lynn <ethanlynnl@vmware.com>2018-06-13 14:00:47 +0800
commitc752aeed6c0c8046f901c0d401e3da3ce76a029b (patch)
tree319a3d632f07282381c9fcb16d23f9936352aba5 /vio
parent8bde08e4be9a0183fb720d6a2b692343597eefcf (diff)
Add test_property_exist
Add test_property_exist Change-Id: Ida3a92c7962f4306b7878ef0465687bd0bf175ea Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
Diffstat (limited to 'vio')
-rw-r--r--vio/vio/tests/test_apiv2_controller.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/vio/vio/tests/test_apiv2_controller.py b/vio/vio/tests/test_apiv2_controller.py
index 132a105..e48f321 100644
--- a/vio/vio/tests/test_apiv2_controller.py
+++ b/vio/vio/tests/test_apiv2_controller.py
@@ -50,3 +50,12 @@ class TestAPIv2Controller(unittest.TestCase):
self.assertEqual(None, cb._convert_default_value("None"))
self.assertEqual(True, cb._convert_default_value("true"))
self.assertEqual(False, cb._convert_default_value("false"))
+
+ def test_property_exist(self):
+ res = {
+ "pp": "dd"
+ }
+ self.assertEqual(True, cb._property_exists(res, "pp", required=False))
+ self.assertEqual(False, cb._property_exists(res, "dd", required=False))
+ self.assertRaises(
+ Exception, cb._property_exists, res, "dd", required=True)