From 51f78b8e8ef1a7a2b3f952ad5d7ae88c1044c106 Mon Sep 17 00:00:00 2001 From: James Page Date: Thu, 8 Feb 2024 09:38:43 +0000 Subject: [PATCH] tests: has_calls -> assert_has_calls Ensure that an assert method is actually used when validating calls in unit tests. This also revealed an issue with the expected calls; query updated to reflect the use of to domain attribute in the security context. Change-Id: I7f71437330a23a2b5f178cf1980ba23260ea4a9b --- .../netapp/dataontap/client/test_client_cmode_rest.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode_rest.py b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode_rest.py index 3be0e0e0e3..8b2bb1a22a 100644 --- a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode_rest.py +++ b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode_rest.py @@ -4312,12 +4312,15 @@ class NetAppRestCmodeClientTestCase(test.TestCase): self.mock_object(self.client, 'send_request', mock.Mock(return_value=fake_response)) self.client.remove_preferred_dcs(fake_ss, svm_uuid) - self.client.send_request.has_calls([ + query = { + 'fqdn': fake.LDAP_AD_SECURITY_SERVICE.get('domain'), + } + self.client.send_request.assert_has_calls([ mock.call(f'/protocols/cifs/domains/{svm_uuid}/' f'preferred-domain-controllers/', 'get'), mock.call(f'/protocols/cifs/domains/{svm_uuid}/' f'preferred-domain-controllers/{fqdn}/{server_ip}', - 'delete', query=fqdn) + 'delete', query=query) ]) def test_remove_preferred_dcs_api_error(self):