Currently, the RPCAPI update_port method is mocked, and its return
value set in the unit tests to the expected value - the modified port.
This isn't really exercising all of the port update API handler, which
should be modifying the port object appropriately and passing it to the
RPCAPI update_port method.
This change adds a side effect to the RPCAPI update_port mock which
saves the Port object that it is passed to the DB. This allows us to
avoid fudging the answer and test the code more thoroughly.
The TestPost test case already does this for port creation.
Reviewed: https:/ /review. openstack. org/482982 /git.openstack. org/cgit/ openstack/ ironic/ commit/ ?id=bfd80a5d39b a4ad153600ea044 e09333a335517a
Committed: https:/
Submitter: Jenkins
Branch: master
commit bfd80a5d39ba4ad 153600ea044e093 33a335517a
Author: Mark Goddard <email address hidden>
Date: Wed Jul 12 14:57:18 2017 +0100
Improve port update API unit tests
Currently, the RPCAPI update_port method is mocked, and its return
value set in the unit tests to the expected value - the modified port.
This isn't really exercising all of the port update API handler, which
should be modifying the port object appropriately and passing it to the
RPCAPI update_port method.
This change adds a side effect to the RPCAPI update_port mock which
saves the Port object that it is passed to the DB. This allows us to
avoid fudging the answer and test the code more thoroughly.
The TestPost test case already does this for port creation.
Change-Id: I77860b2a24da65 9418f93c380db67 ff4726257ff
Related-Bug: #1666009