Pass autospec=True while patching the function.
Create the mock object for mock_helper using mock.sentinel. This gives
us some extra protection because sentinel object is not callable. If the
code tries to use it like a function, it will raise a TypeError.
This patch also changes assertFalse() to assert_not_called().
Reviewed: https:/ /review. opendev. org/c/openstack /cinder/ +/877185 /opendev. org/openstack/ cinder/ commit/ 41da45ddd3b9677 b4ee7f82f1a59e3 bca9dee615
Committed: https:/
Submitter: "Zuul (22348)"
Branch: master
commit 41da45ddd3b9677 b4ee7f82f1a59e3 bca9dee615
Author: Khadija Kamran <email address hidden>
Date: Mon Mar 13 01:14:01 2023 +0500
Improve test_execute_ root_and_ helper
Pass autospec=True while patching the function. not_called( ).
Create the mock object for mock_helper using mock.sentinel. This gives
us some extra protection because sentinel object is not callable. If the
code tries to use it like a function, it will raise a TypeError.
This patch also changes assertFalse() to assert_
Partial-Bug: #2004174 aa0b50dcbf71ff4 b0960403f96
Change-Id: I209ff5d0fd7e3e
Signed-off-by: Khadija Kamran <email address hidden>