Merge "Trivial: Change hardcoded values in tempest plugin"
This commit is contained in:
commit
64eb96d7ca
@ -13,6 +13,7 @@
|
||||
import functools
|
||||
|
||||
from oslo_serialization import jsonutils as json
|
||||
from six.moves import http_client
|
||||
from six.moves.urllib import parse as urllib
|
||||
from tempest.lib.common import api_version_utils
|
||||
from tempest.lib.common import rest_client
|
||||
@ -133,7 +134,7 @@ class BaremetalClient(rest_client.RestClient):
|
||||
|
||||
resp, body = self.get(uri, headers=headers,
|
||||
extra_headers=extra_headers)
|
||||
self.expected_success(200, resp.status)
|
||||
self.expected_success(http_client.OK, resp.status)
|
||||
|
||||
return resp, self.deserialize(body)
|
||||
|
||||
@ -149,7 +150,7 @@ class BaremetalClient(rest_client.RestClient):
|
||||
else:
|
||||
uri = self._get_uri(resource, uuid=uuid, permanent=permanent)
|
||||
resp, body = self.get(uri)
|
||||
self.expected_success(200, resp.status)
|
||||
self.expected_success(http_client.OK, resp.status)
|
||||
|
||||
return resp, self.deserialize(body)
|
||||
|
||||
@ -167,7 +168,7 @@ class BaremetalClient(rest_client.RestClient):
|
||||
uri = self._get_uri(resource)
|
||||
|
||||
resp, body = self.post(uri, body=body)
|
||||
self.expected_success(201, resp.status)
|
||||
self.expected_success(http_client.CREATED, resp.status)
|
||||
|
||||
return resp, self.deserialize(body)
|
||||
|
||||
@ -186,7 +187,7 @@ class BaremetalClient(rest_client.RestClient):
|
||||
uri = self._get_uri(resource)
|
||||
|
||||
resp, body = self.post(uri, body=body)
|
||||
self.expected_success(204, resp.status)
|
||||
self.expected_success(http_client.NO_CONTENT, resp.status)
|
||||
|
||||
return resp
|
||||
|
||||
@ -201,7 +202,7 @@ class BaremetalClient(rest_client.RestClient):
|
||||
uri = self._get_uri(resource, uuid)
|
||||
|
||||
resp, body = self.delete(uri)
|
||||
self.expected_success(204, resp.status)
|
||||
self.expected_success(http_client.NO_CONTENT, resp.status)
|
||||
return resp, body
|
||||
|
||||
def _patch_request(self, resource, uuid, patch_object):
|
||||
@ -217,7 +218,7 @@ class BaremetalClient(rest_client.RestClient):
|
||||
patch_body = json.dumps(patch_object)
|
||||
|
||||
resp, body = self.patch(uri, body=patch_body)
|
||||
self.expected_success(200, resp.status)
|
||||
self.expected_success(http_client.OK, resp.status)
|
||||
return resp, self.deserialize(body)
|
||||
|
||||
@handle_errors
|
||||
@ -242,5 +243,6 @@ class BaremetalClient(rest_client.RestClient):
|
||||
put_body = json.dumps(put_object)
|
||||
|
||||
resp, body = self.put(uri, body=put_body)
|
||||
self.expected_success([202, 204], resp.status)
|
||||
self.expected_success([http_client.ACCEPTED, http_client.NO_CONTENT],
|
||||
resp.status)
|
||||
return resp, body
|
||||
|
@ -10,6 +10,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from six.moves import http_client
|
||||
|
||||
from ironic_tempest_plugin.services.baremetal import base
|
||||
|
||||
|
||||
@ -318,7 +320,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
request = {'boot_device': boot_device, 'persistent': persistent}
|
||||
resp, body = self._put_request('nodes/%s/management/boot_device' %
|
||||
node_uuid, request)
|
||||
self.expected_success(204, resp.status)
|
||||
self.expected_success(http_client.NO_CONTENT, resp.status)
|
||||
return body
|
||||
|
||||
@base.handle_errors
|
||||
@ -330,7 +332,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
"""
|
||||
path = 'nodes/%s/management/boot_device' % node_uuid
|
||||
resp, body = self._list_request(path)
|
||||
self.expected_success(200, resp.status)
|
||||
self.expected_success(http_client.OK, resp.status)
|
||||
return body
|
||||
|
||||
@base.handle_errors
|
||||
@ -342,7 +344,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
"""
|
||||
path = 'nodes/%s/management/boot_device/supported' % node_uuid
|
||||
resp, body = self._list_request(path)
|
||||
self.expected_success(200, resp.status)
|
||||
self.expected_success(http_client.OK, resp.status)
|
||||
return body
|
||||
|
||||
@base.handle_errors
|
||||
@ -354,7 +356,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
"""
|
||||
|
||||
resp, body = self._show_request('nodes/states/console', node_uuid)
|
||||
self.expected_success(200, resp.status)
|
||||
self.expected_success(http_client.OK, resp.status)
|
||||
return resp, body
|
||||
|
||||
@base.handle_errors
|
||||
@ -370,7 +372,7 @@ class BaremetalClient(base.BaremetalClient):
|
||||
enabled = {'enabled': enabled}
|
||||
resp, body = self._put_request('nodes/%s/states/console' % node_uuid,
|
||||
enabled)
|
||||
self.expected_success(202, resp.status)
|
||||
self.expected_success(http_client.ACCEPTED, resp.status)
|
||||
return resp, body
|
||||
|
||||
@base.handle_errors
|
||||
@ -410,5 +412,5 @@ class BaremetalClient(base.BaremetalClient):
|
||||
:param vif_id: An ID representing the VIF
|
||||
"""
|
||||
resp, body = self._delete_request('nodes/%s/vifs' % node_uuid, vif_id)
|
||||
self.expected_success(204, resp.status)
|
||||
self.expected_success(http_client.NO_CONTENT, resp.status)
|
||||
return resp, body
|
||||
|
Loading…
Reference in New Issue
Block a user