Merge "Add get pod unit test case"

This commit is contained in:
Jenkins 2017-02-15 08:47:05 +00:00 committed by Gerrit Code Review
commit c4b0822dee
2 changed files with 13 additions and 5 deletions

View File

@ -64,11 +64,6 @@ def update_pod(context, pod_id, update_dict):
return core.update_resource(context, models.Pod, pod_id, update_dict)
def get_pod_by_pod_id(context, pod_id):
with context.session.begin():
return core.get_resource(context, models.Pod, pod_id)
def create_cached_endpoints(context, config_dict):
with context.session.begin():
return core.create_resource(context, models.CachedEndpoint,

View File

@ -303,6 +303,19 @@ class APITest(unittest.TestCase):
pod = api.get_pod_by_name(self.context, region_name)
self.assertEqual(pod['region_name'], region_name)
def test_get_pod(self):
self._create_pod(0, 'test_az_uuid1')
self._create_pod(1, 'test_az_uuid1')
self._create_pod(2, 'test_az_uuid2')
pod_id = 'test_pod_uuid_0'
pod = api.get_pod(self.context, pod_id)
self.assertEqual(pod['pod_id'], pod_id)
pod_id = 'test_pod_uuid_3'
self.assertRaises(
exceptions.ResourceNotFound, api.get_pod, self.context, pod_id)
def test_delete_mappings_by_bottom_id(self):
self._create_pod(0, 'test_az_uuid_0')
self._create_pod(1, 'test_az_uuid_1')