Fix wrong message of invalid boot "enabled" parameter

Previously, it return allowed boot "target" values by mistake. So
fixed it by using allowed boot "enabled" values as expected.

Closes-Bug: #1758202
Change-Id: Id6a7665c3d2d18ee5cefde41b7b575bc1b3413a4
This commit is contained in:
Lin Yang 2018-03-03 12:58:43 -08:00
parent ad0e411e13
commit 49c66bbdc8
2 changed files with 9 additions and 5 deletions

View File

@ -214,7 +214,7 @@ class System(base.ResourceBase):
if enabled not in sys_maps.BOOT_SOURCE_ENABLED_MAP_REV:
raise exceptions.InvalidParameterValueError(
parameter='enabled', value=enabled,
valid_values=list(sys_maps.BOOT_SOURCE_TARGET_MAP_REV))
valid_values=list(sys_maps.BOOT_SOURCE_ENABLED_MAP_REV))
data = {
'Boot': {

View File

@ -213,10 +213,14 @@ class SystemTestCase(base.TestCase):
'invalid-target')
def test_set_system_boot_source_invalid_enabled(self):
self.assertRaises(exceptions.InvalidParameterValueError,
self.sys_inst.set_system_boot_source,
sushy.BOOT_SOURCE_TARGET_HDD,
enabled='invalid-enabled')
with self.assertRaisesRegex(
exceptions.InvalidParameterValueError,
'"enabled" value.*{0}'.format(
list(sys_map.BOOT_SOURCE_ENABLED_MAP_REV))):
self.sys_inst.set_system_boot_source(
sushy.BOOT_SOURCE_TARGET_HDD,
enabled='invalid-enabled')
def test__get_processor_collection_path_missing_processors_attr(self):
self.sys_inst._json.pop('Processors')