diff --git a/oneview_client/client.py b/oneview_client/client.py index a87199e..6406c6e 100644 --- a/oneview_client/client.py +++ b/oneview_client/client.py @@ -148,7 +148,7 @@ class BaseClient(object): headers = { 'content-type': 'application/json', - 'X-Api-Version': SUPPORTED_ONEVIEW_VERSION, + 'X-Api-Version': str(SUPPORTED_ONEVIEW_VERSION), 'Auth': self.session_id } url = '%s%s' % (self.manager_url, uri) diff --git a/oneview_client/tests/functional/test_oneview_client.py b/oneview_client/tests/functional/test_oneview_client.py index b1af2a6..6a4750a 100644 --- a/oneview_client/tests/functional/test_oneview_client.py +++ b/oneview_client/tests/functional/test_oneview_client.py @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import copy import mock import requests import six.moves.http_client as http_client @@ -140,8 +141,9 @@ class OneViewClientTestCase(unittest.TestCase): ) profile = mock.MagicMock() profile.status_code = http_client.OK + profile_fixture = copy.deepcopy(fixtures.SERVER_PROFILE_JSON) profile.json = mock.MagicMock( - return_value=fixtures.SERVER_PROFILE_JSON + return_value=profile_fixture ) mock_get.side_effect = [hardware, profile] @@ -179,8 +181,9 @@ class OneViewClientTestCase(unittest.TestCase): ) profile = mock.MagicMock() profile.status_code = http_client.OK + profile_fixture = copy.deepcopy(fixtures.SERVER_PROFILE_JSON) profile.json = mock.MagicMock( - return_value=fixtures.SERVER_PROFILE_JSON + return_value=profile_fixture ) mock_get.side_effect = [hardware, profile] @@ -307,8 +310,9 @@ class OneViewClientTestCase(unittest.TestCase): ) profile = mock.MagicMock() profile.status_code = http_client.OK + profile_fixture = copy.deepcopy(fixtures.SERVER_PROFILE_JSON) profile.json = mock.MagicMock( - return_value=fixtures.SERVER_PROFILE_JSON + return_value=profile_fixture ) mock_get.side_effect = [hardware, profile, hardware, profile] 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') 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, headers=mock.ANY, verify=True @@ -347,8 +351,9 @@ class OneViewClientTestCase(unittest.TestCase): ) profile = mock.MagicMock() profile.status_code = http_client.OK + profile_fixture = copy.deepcopy(fixtures.SERVER_PROFILE_JSON) profile.json = mock.MagicMock( - return_value=fixtures.SERVER_PROFILE_JSON + return_value=profile_fixture ) ilo_system = mock.MagicMock() ilo_system.status_code = http_client.OK @@ -651,8 +656,9 @@ class OneViewClientV2TestCase(unittest.TestCase): self.password) response = mock_get.return_value response.status_code = http_client.OK + profile_fixture = copy.deepcopy(fixtures.SERVER_PROFILE_JSON) response.json = mock.MagicMock( - return_value=fixtures.SERVER_PROFILE_JSON + return_value=profile_fixture ) mock_get.return_value = response diff --git a/oneview_client/tests/unit/test_oneview_client.py b/oneview_client/tests/unit/test_oneview_client.py index 682bcdf..f8dcb1a 100644 --- a/oneview_client/tests/unit/test_oneview_client.py +++ b/oneview_client/tests/unit/test_oneview_client.py @@ -303,8 +303,9 @@ class OneViewClientTestCase(unittest.TestCase): models.ServerHardware.from_json(fixtures.SERVER_HARDWARE_JSON) ) mock_get_server_hardware.return_value = server_hardware + profile = copy.deepcopy(fixtures.SERVER_PROFILE_JSON) 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['boot'] = {