Add get pod unit test case

1. What is the problem
Tricircle does not have get pod unit test case

2. What is the solution to the problem
Implement related test case

3. What the features need to be implemented to the Tricircle
No new features

Change-Id: Icf68127871d3c3393f43d54ee0a853215c6bad2f
This commit is contained in:
xiulin yin 2017-02-14 17:51:09 +08:00
parent 72639ba955
commit e9a0251253
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

@ -256,6 +256,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')