Add some missing Unit Tests to test_utils.py

Change-Id: If33fba535f3541ade0b9fc516cf9b0bd4d215357
This commit is contained in:
Pradeep Kumar Singh 2015-07-27 14:24:39 +09:00
parent 97ae902a8d
commit 5962e595a0

View File

@ -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)