Browse Source

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
changes/41/433541/2
xiulin yin 6 years ago
parent
commit
e9a0251253
  1. 5
      tricircle/db/api.py
  2. 13
      tricircle/tests/unit/db/test_api.py

5
tricircle/db/api.py

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

13
tricircle/tests/unit/db/test_api.py

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

Loading…
Cancel
Save