tests: Handle overridden 'verify_delete' (kw)args

Sometimes we want to pass an explicit empty list/iterable to indicate
that there are no expected (keyword) arguments. You can't do this with
the current 'a or b' pattern. Rather, we need an explicit 'is None'
check as used in the other 'verify_foo' helpers. Make it so.

Change-Id: I348927b14fb91db7328c46672496c0048e2e34f6
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2021-12-20 11:59:48 +00:00
parent 26c9bc22e3
commit 9d45886028
2 changed files with 8 additions and 5 deletions
openstack/tests/unit

@ -588,7 +588,6 @@ class TestCompute(TestComputeProxy):
self.verify_delete(self.proxy.delete_server_interface,
server_interface.ServerInterface, True,
method_kwargs={"server": "test_id"},
expected_args=[],
expected_kwargs={"server_id": "test_id"})
def test_server_interface_get(self):

@ -108,11 +108,15 @@ class TestProxyBase(base.TestCase):
expected_args=None, expected_kwargs=None,
mock_method="openstack.proxy.Proxy._delete",
):
method_args = method_args or ['resource_id']
method_kwargs = method_kwargs or {}
if method_args is None:
method_args = ['resource_id']
if method_kwargs is None:
method_kwargs = {}
method_kwargs["ignore_missing"] = ignore_missing
expected_args = expected_args or method_args.copy()
expected_kwargs = expected_kwargs or method_kwargs.copy()
if expected_args is None:
expected_args = method_args.copy()
if expected_kwargs is None:
expected_kwargs = method_kwargs.copy()
self._verify(
mock_method,