Update tests to reflect WSME 0.8 fixes

Before WSME would ignore fields that didn't exist in the resource, but
with the version 0.8.0 WSME will raise HTTP 400 (BadRequest) when one
attempt to create a resource with nonexistent fields.

Change-Id: Ie6a80ee03428b98c72e3704202b2b5cbfce93ab6
This commit is contained in:
Lucas Alvares Gomes 2015-08-25 17:58:25 +01:00
parent 5e93b59ac1
commit 3d45795abb
2 changed files with 6 additions and 2 deletions

View File

@ -90,13 +90,19 @@ def remove_internal(values, internal):
def node_post_data(**kw): def node_post_data(**kw):
node = utils.get_test_node(**kw) node = utils.get_test_node(**kw)
# These values are not part of the API object
node.pop('conductor_affinity') node.pop('conductor_affinity')
node.pop('chassis_id')
node.pop('target_raid_config')
node.pop('raid_config')
internal = node_controller.NodePatchType.internal_attrs() internal = node_controller.NodePatchType.internal_attrs()
return remove_internal(node, internal) return remove_internal(node, internal)
def port_post_data(**kw): def port_post_data(**kw):
port = utils.get_test_port(**kw) port = utils.get_test_port(**kw)
# node_id is not part of the API object
port.pop('node_id')
internal = port_controller.PortPatchType.internal_attrs() internal = port_controller.PortPatchType.internal_attrs()
return remove_internal(port, internal) return remove_internal(port, internal)
@ -112,6 +118,5 @@ def post_get_test_node(**kw):
# we have to use chassis_uuid # we have to use chassis_uuid
node = node_post_data(**kw) node = node_post_data(**kw)
chassis = utils.get_test_chassis() chassis = utils.get_test_chassis()
node['chassis_id'] = None
node['chassis_uuid'] = kw.get('chassis_uuid', chassis['uuid']) node['chassis_uuid'] = kw.get('chassis_uuid', chassis['uuid'])
return node return node

View File

@ -45,7 +45,6 @@ from ironic.tests.objects import utils as obj_utils
def post_get_test_port(**kw): def post_get_test_port(**kw):
port = apiutils.port_post_data(**kw) port = apiutils.port_post_data(**kw)
node = dbutils.get_test_node() node = dbutils.get_test_node()
del port['node_id']
port['node_uuid'] = kw.get('node_uuid', node['uuid']) port['node_uuid'] = kw.get('node_uuid', node['uuid'])
return port return port