diff options
author | Yun Huang <yun.huang@windriver.com> | 2018-07-04 15:19:13 +0800 |
---|---|---|
committer | Yun Huang <yun.huang@windriver.com> | 2018-07-04 15:19:13 +0800 |
commit | 924b3f0959872cf033c287d2c597defed6befc29 (patch) | |
tree | e7ff5b63d129c6138e54a7d6635b03cc10719b73 /windriver/titanium_cloud/registration/tests | |
parent | 0c97e69480aa3113cbf0cd54ebd35998a3078089 (diff) |
UT to discover HPA flavor
Change-Id: Ifda7cc6930e743fbfe0366ee45280738c4d08ddd
Issue-ID: MULTICLOUD-230
Signed-off-by: Yun Huang <yun.huang@windriver.com>
Diffstat (limited to 'windriver/titanium_cloud/registration/tests')
-rw-r--r-- | windriver/titanium_cloud/registration/tests/test_registration2.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/windriver/titanium_cloud/registration/tests/test_registration2.py b/windriver/titanium_cloud/registration/tests/test_registration2.py index 38cbabdb..3bfd138a 100644 --- a/windriver/titanium_cloud/registration/tests/test_registration2.py +++ b/windriver/titanium_cloud/registration/tests/test_registration2.py @@ -77,6 +77,27 @@ MOCK_GET_FLAVOR_RESPONSE = { ] } +MOCK_GET_FLAVOR_RESPONSE_w_hpa_numa = { + "flavors": [ + { + "id": "1", "name": "onap.big", "vcpus": 6, "ram": "8192", + "disk": "10", "OS-FLV-EXT-DATA:ephemeral": False, + "swap": True, "os-flavor-access:is_public": True, + "OS-FLV-DISABLED:disabled": True, "link": [{"href":1}] + } + ] +} +MOCK_GET_FLAVOR_EXTRASPECS_RESPONSE_w_hpa_numa = { + "flavors": [ + { + "id": "1", "name": "onap.big", "vcpus": 6, "ram": "8192", + "disk": "10", "OS-FLV-EXT-DATA:ephemeral": False, + "swap": True, "os-flavor-access:is_public": True, + "OS-FLV-DISABLED:disabled": True, "link": [{"href":1}] + } + ] +} + class TestRegistration2(unittest.TestCase): def setUp(self): self.client = Client() @@ -87,6 +108,8 @@ class TestRegistration2(unittest.TestCase): def test_discover_flavors(self): + restcall.req_to_aai = mock.Mock() + restcall.req_to_aai.return_value = (0, {}, status.HTTP_200_OK) mock_session = test_base.get_mock_session( ["get"], {"get": { "content": MOCK_GET_FLAVOR_RESPONSE}}), @@ -95,3 +118,18 @@ class TestRegistration2(unittest.TestCase): session=mock_session, viminfo=MOCK_VIM_INFO) self.assertIsNone(resp) + + def test_discover_flavors_w_hpa_numa(self): + restcall.req_to_aai = mock.Mock() + restcall.req_to_aai.return_value = (0, {}, status.HTTP_200_OK) + mock_session = test_base.get_mock_session( + ["get"], {"side_effect": [{ + "content": MOCK_GET_FLAVOR_RESPONSE_w_hpa_numa}, + { + "content": MOCK_GET_FLAVOR_EXTRASPECS_RESPONSE_w_hpa_numa} + ]}), + + resp = self.view._discover_flavors(vimid="windriver-hudson-dc_RegionOne", + session=mock_session, viminfo=MOCK_VIM_INFO) + + self.assertIsNone(resp) |