From 5962e595a09ad1e10a87903eb14073aa071a34f5 Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Singh Date: Mon, 27 Jul 2015 14:24:39 +0900 Subject: [PATCH] Add some missing Unit Tests to test_utils.py Change-Id: If33fba535f3541ade0b9fc516cf9b0bd4d215357 --- designateclient/tests/test_utils.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/designateclient/tests/test_utils.py b/designateclient/tests/test_utils.py index 359d0e19..e4fa7b0f 100644 --- a/designateclient/tests/test_utils.py +++ b/designateclient/tests/test_utils.py @@ -62,3 +62,24 @@ class UtilsTestCase(base.TestCase): self.assertRaises(exceptions.NoUniqueMatch, self._find_resourceid_by_name_or_id, 'baba', by_name=True) + + def test_load_schema(self): + schema = utils.load_schema('v1', 'domain') + self.assertIsInstance(schema, dict) + + def test_load_schema_missing(self): + self.assertRaises(exceptions.ResourceNotFound, utils.load_schema, + 'v1', 'missing') + + def test_resource_string_empty_param(self): + self.assertRaises(ValueError, utils.resource_string) + + def test_resource_string(self): + name = ['schemas', 'v1', 'domain.json'] + resource_string = utils.resource_string(*name) + self.assertIsNotNone(resource_string) + + def test_resource_string_missing(self): + name = ['schemas', 'v1', 'missing'] + self.assertRaises(exceptions.ResourceNotFound, utils.resource_string, + *name)