From c752aeed6c0c8046f901c0d401e3da3ce76a029b Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Wed, 13 Jun 2018 14:00:47 +0800 Subject: Add test_property_exist Add test_property_exist Change-Id: Ida3a92c7962f4306b7878ef0465687bd0bf175ea Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn --- vio/vio/tests/test_apiv2_controller.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'vio') 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) -- cgit 1.2.3-korg