Trivial: Change hardcoded values in tempest plugin
Replace hardcoded http status codes in ironic_tempest_plugin
Change-Id: Ib13d01e297e949f83b32977fc60291b6516d9b41
diff --git a/ironic_tempest_plugin/services/baremetal/base.py b/ironic_tempest_plugin/services/baremetal/base.py
index 30589e1..ec572b2 100644
--- a/ironic_tempest_plugin/services/baremetal/base.py
+++ b/ironic_tempest_plugin/services/baremetal/base.py
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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