From bcfe996deb829b8cfbe9394216c100b2772c770e Mon Sep 17 00:00:00 2001 From: Richard Pioso Date: Fri, 28 Jul 2017 18:58:26 -0400 Subject: [PATCH] Simplify wait_until_idrac_is_ready() calls This change simplifies the internal calls to dracclient.client.WSManClient.wait_until_idrac_is_ready() by no longer passing arguments. That makes the code cleaner and easier to understand. It contains no functional change. The arguments no longer need to be passed, because that function's default parameter values are now None, which means use the values that were provided when the WSManClient object was created. The default values provided at creation are equal to the arguments that were being explicitly passed. Change-Id: I70237bb9eda49a98c55a452b7f534a1e720696bb Related-Bug: #1697558 --- dracclient/client.py | 6 ++---- dracclient/tests/test_client.py | 8 ++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/dracclient/client.py b/dracclient/client.py index 58a69d5..4c68a9d 100644 --- a/dracclient/client.py +++ b/dracclient/client.py @@ -626,8 +626,7 @@ class WSManClient(wsman.Client): :raises: WSManInvalidResponse when receiving invalid response """ if wait_for_idrac: - self.wait_until_idrac_is_ready(self._ready_retries, - self._ready_retry_delay) + self.wait_until_idrac_is_ready() return super(WSManClient, self).enumerate(resource_uri, optimization, max_elems, auto_pull, @@ -656,8 +655,7 @@ class WSManClient(wsman.Client): :raises: DRACUnexpectedReturnValue on return value mismatch """ if wait_for_idrac: - self.wait_until_idrac_is_ready(self._ready_retries, - self._ready_retry_delay) + self.wait_until_idrac_is_ready() if selectors is None: selectors = {} diff --git a/dracclient/tests/test_client.py b/dracclient/tests/test_client.py index 8dd8b66..cb941e6 100644 --- a/dracclient/tests/test_client.py +++ b/dracclient/tests/test_client.py @@ -34,9 +34,7 @@ class WSManClientTestCase(base.BaseTest): client = dracclient.client.WSManClient(**test_utils.FAKE_ENDPOINT) resp = client.enumerate('http://resource') - mock_wait_until_idrac_is_ready.assert_called_once_with( - client, constants.DEFAULT_IDRAC_IS_READY_RETRIES, - constants.DEFAULT_IDRAC_IS_READY_RETRY_DELAY_SEC) + mock_wait_until_idrac_is_ready.assert_called_once_with(client) self.assertEqual('yay!', resp.text) @mock.patch.object(dracclient.client.WSManClient, @@ -66,9 +64,7 @@ class WSManClientTestCase(base.BaseTest): client = dracclient.client.WSManClient(**test_utils.FAKE_ENDPOINT) resp = client.invoke('http://resource', 'Foo') - mock_wait_until_idrac_is_ready.assert_called_once_with( - client, constants.DEFAULT_IDRAC_IS_READY_RETRIES, - constants.DEFAULT_IDRAC_IS_READY_RETRY_DELAY_SEC) + mock_wait_until_idrac_is_ready.assert_called_once_with(client) self.assertEqual('yay!', resp.find('result').text) @mock.patch.object(dracclient.client.WSManClient,