From 5400658bfdf76364a029788d1fd9918713326b3c Mon Sep 17 00:00:00 2001 From: xiulin yin Date: Mon, 13 Feb 2017 10:17:01 +0800 Subject: [PATCH] Add get pod by region unit test case 1. What is the problem Tricircle does not have get pod by region name 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: I2d0f529d465e29c75169091ac6c95e5368d7e57b --- tricircle/tests/unit/db/test_api.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tricircle/tests/unit/db/test_api.py b/tricircle/tests/unit/db/test_api.py index 1afede11..88e9a3d0 100644 --- a/tricircle/tests/unit/db/test_api.py +++ b/tricircle/tests/unit/db/test_api.py @@ -226,5 +226,18 @@ class APITest(unittest.TestCase): self.assertEqual(pod['region_name'], 'test_pod_0') self.assertEqual(pod['az_name'], '') + def test_get_pod_by_region(self): + self._create_pod(0, 'test_az_uuid1') + self._create_pod(1, 'test_az_uuid1') + self._create_pod(2, 'test_az_uuid2') + + region_name = 'test_pod_3' + pod = api.get_pod_by_name(self.context, region_name) + self.assertIsNone(pod) + + region_name = 'test_pod_0' + pod = api.get_pod_by_name(self.context, region_name) + self.assertEqual(pod['region_name'], region_name) + def tearDown(self): core.ModelBase.metadata.drop_all(core.get_engine())