Check resource class before using

check if the resource class(VCPU, memory, disk) in the return
dictionary. If they are, don't need to use dict.get() with a
default value because the parameters are required.

Partially Implements: blueprint improve-compute-data-model

Change-Id: Icb8c672d0e87e6e5f030a2222f928d1bbd069e3c
This commit is contained in:
licanwei
2019-07-25 15:53:45 +08:00
parent e0f70cb87c
commit 0986168fe6
2 changed files with 30 additions and 19 deletions

View File

@@ -332,7 +332,7 @@ class TestNovaModelBuilder(base.TestCase):
""""""
mock_placement = mock.Mock(name="placement_helper")
mock_placement.get_inventories.return_value = dict()
mock_placement.get_usages_for_resource_provider.return_value = dict()
mock_placement.get_usages_for_resource_provider.return_value = None
m_placement_helper.return_value = mock_placement
m_nova.return_value.get_aggregate_list.return_value = \
[mock.Mock(id=1, name='example'),