Merge "Passing SUPPORTED_ONEVIEW_VERSION as string + transient error fix"
This commit is contained in:
commit
c52a05ad81
@ -148,7 +148,7 @@ class BaseClient(object):
|
|||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
'content-type': 'application/json',
|
'content-type': 'application/json',
|
||||||
'X-Api-Version': SUPPORTED_ONEVIEW_VERSION,
|
'X-Api-Version': str(SUPPORTED_ONEVIEW_VERSION),
|
||||||
'Auth': self.session_id
|
'Auth': self.session_id
|
||||||
}
|
}
|
||||||
url = '%s%s' % (self.manager_url, uri)
|
url = '%s%s' % (self.manager_url, uri)
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import copy
|
||||||
import mock
|
import mock
|
||||||
import requests
|
import requests
|
||||||
import six.moves.http_client as http_client
|
import six.moves.http_client as http_client
|
||||||
@ -140,8 +141,9 @@ class OneViewClientTestCase(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
profile = mock.MagicMock()
|
profile = mock.MagicMock()
|
||||||
profile.status_code = http_client.OK
|
profile.status_code = http_client.OK
|
||||||
|
profile_fixture = copy.deepcopy(fixtures.SERVER_PROFILE_JSON)
|
||||||
profile.json = mock.MagicMock(
|
profile.json = mock.MagicMock(
|
||||||
return_value=fixtures.SERVER_PROFILE_JSON
|
return_value=profile_fixture
|
||||||
)
|
)
|
||||||
mock_get.side_effect = [hardware, profile]
|
mock_get.side_effect = [hardware, profile]
|
||||||
|
|
||||||
@ -179,8 +181,9 @@ class OneViewClientTestCase(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
profile = mock.MagicMock()
|
profile = mock.MagicMock()
|
||||||
profile.status_code = http_client.OK
|
profile.status_code = http_client.OK
|
||||||
|
profile_fixture = copy.deepcopy(fixtures.SERVER_PROFILE_JSON)
|
||||||
profile.json = mock.MagicMock(
|
profile.json = mock.MagicMock(
|
||||||
return_value=fixtures.SERVER_PROFILE_JSON
|
return_value=profile_fixture
|
||||||
)
|
)
|
||||||
mock_get.side_effect = [hardware, profile]
|
mock_get.side_effect = [hardware, profile]
|
||||||
|
|
||||||
@ -307,8 +310,9 @@ class OneViewClientTestCase(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
profile = mock.MagicMock()
|
profile = mock.MagicMock()
|
||||||
profile.status_code = http_client.OK
|
profile.status_code = http_client.OK
|
||||||
|
profile_fixture = copy.deepcopy(fixtures.SERVER_PROFILE_JSON)
|
||||||
profile.json = mock.MagicMock(
|
profile.json = mock.MagicMock(
|
||||||
return_value=fixtures.SERVER_PROFILE_JSON
|
return_value=profile_fixture
|
||||||
)
|
)
|
||||||
mock_get.side_effect = [hardware, profile, hardware, profile]
|
mock_get.side_effect = [hardware, profile, hardware, profile]
|
||||||
oneview_client._wait_for_task_to_complete = mock__wait_for_task
|
oneview_client._wait_for_task_to_complete = mock__wait_for_task
|
||||||
@ -320,7 +324,7 @@ class OneViewClientTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
oneview_client.set_boot_device(node_info, 'PXE')
|
oneview_client.set_boot_device(node_info, 'PXE')
|
||||||
mock_put.assert_called_once_with(
|
mock_put.assert_called_once_with(
|
||||||
self.manager_url + fixtures.SERVER_PROFILE_JSON.get('uri'),
|
self.manager_url + profile_fixture.get('uri'),
|
||||||
data=mock.ANY,
|
data=mock.ANY,
|
||||||
headers=mock.ANY,
|
headers=mock.ANY,
|
||||||
verify=True
|
verify=True
|
||||||
@ -347,8 +351,9 @@ class OneViewClientTestCase(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
profile = mock.MagicMock()
|
profile = mock.MagicMock()
|
||||||
profile.status_code = http_client.OK
|
profile.status_code = http_client.OK
|
||||||
|
profile_fixture = copy.deepcopy(fixtures.SERVER_PROFILE_JSON)
|
||||||
profile.json = mock.MagicMock(
|
profile.json = mock.MagicMock(
|
||||||
return_value=fixtures.SERVER_PROFILE_JSON
|
return_value=profile_fixture
|
||||||
)
|
)
|
||||||
ilo_system = mock.MagicMock()
|
ilo_system = mock.MagicMock()
|
||||||
ilo_system.status_code = http_client.OK
|
ilo_system.status_code = http_client.OK
|
||||||
@ -651,8 +656,9 @@ class OneViewClientV2TestCase(unittest.TestCase):
|
|||||||
self.password)
|
self.password)
|
||||||
response = mock_get.return_value
|
response = mock_get.return_value
|
||||||
response.status_code = http_client.OK
|
response.status_code = http_client.OK
|
||||||
|
profile_fixture = copy.deepcopy(fixtures.SERVER_PROFILE_JSON)
|
||||||
response.json = mock.MagicMock(
|
response.json = mock.MagicMock(
|
||||||
return_value=fixtures.SERVER_PROFILE_JSON
|
return_value=profile_fixture
|
||||||
)
|
)
|
||||||
mock_get.return_value = response
|
mock_get.return_value = response
|
||||||
|
|
||||||
|
@ -303,8 +303,9 @@ class OneViewClientTestCase(unittest.TestCase):
|
|||||||
models.ServerHardware.from_json(fixtures.SERVER_HARDWARE_JSON)
|
models.ServerHardware.from_json(fixtures.SERVER_HARDWARE_JSON)
|
||||||
)
|
)
|
||||||
mock_get_server_hardware.return_value = server_hardware
|
mock_get_server_hardware.return_value = server_hardware
|
||||||
|
profile = copy.deepcopy(fixtures.SERVER_PROFILE_JSON)
|
||||||
mock_get_server_profile.return_value = (
|
mock_get_server_profile.return_value = (
|
||||||
models.ServerProfile.from_json(fixtures.SERVER_PROFILE_JSON)
|
models.ServerProfile.from_json(profile)
|
||||||
)
|
)
|
||||||
expected_profile = copy.deepcopy(fixtures.SERVER_PROFILE_JSON)
|
expected_profile = copy.deepcopy(fixtures.SERVER_PROFILE_JSON)
|
||||||
expected_profile['boot'] = {
|
expected_profile['boot'] = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user