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
This commit is contained in:
James Page 2024-02-08 09:38:43 +00:00
parent 796037ea7f
commit 51f78b8e8e
No known key found for this signature in database
GPG Key ID: BFECAECBA0E7D8C3
1 changed files with 5 additions and 2 deletions

View File

@ -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):