summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/api/utils.py
diff options
context:
space:
mode:
authorVladyslav Drok <vdrok@mirantis.com>2016-11-16 17:26:09 +0200
committerVladyslav Drok <vdrok@mirantis.com>2016-12-15 22:45:42 +0000
commitcce428112e8f258cf09483dbf245822ba6a2d5cf (patch)
treeb646f7ea56b08886b423c766695ad80e044132b6 /ironic/tests/unit/api/utils.py
parent3f5bccd008d06508c0fbc58c22a9b6a188de97e4 (diff)
downloadironic-cce428112e8f258cf09483dbf245822ba6a2d5cf.tar.gz
Add portgroup configuration fields
This change adds mode and properties fields into portgroup object and adds a new API microversion to work with them. It also makes portgroups' address field optional for all API microversions. Partial-Bug: #1618754 Change-Id: Id8c62fa56908040b0df16cc54c122ce2473a4587
Diffstat (limited to 'ironic/tests/unit/api/utils.py')
-rw-r--r--ironic/tests/unit/api/utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/ironic/tests/unit/api/utils.py b/ironic/tests/unit/api/utils.py
index e9193a524..702a7c943 100644
--- a/ironic/tests/unit/api/utils.py
+++ b/ironic/tests/unit/api/utils.py
@@ -139,7 +139,18 @@ def post_get_test_node(**kw):
def portgroup_post_data(**kw):
"""Return a Portgroup object without internal attributes."""
portgroup = utils.get_test_portgroup(**kw)
+
+ # node_id is not a part of the API object
portgroup.pop('node_id')
+
+ # NOTE(jroll): pop out fields that were introduced in later API versions,
+ # unless explicitly requested. Otherwise, these will cause tests using
+ # older API versions to fail.
+ new_api_ver_arguments = ['mode', 'properties']
+ for arg in new_api_ver_arguments:
+ if arg not in kw:
+ portgroup.pop(arg)
+
internal = portgroup_controller.PortgroupPatchType.internal_attrs()
return remove_internal(portgroup, internal)