aboutsummaryrefslogtreecommitdiffstats
path: root/keystone-moon/keystone/tests/unit/rest.py
diff options
context:
space:
mode:
Diffstat (limited to 'keystone-moon/keystone/tests/unit/rest.py')
-rw-r--r--keystone-moon/keystone/tests/unit/rest.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/keystone-moon/keystone/tests/unit/rest.py b/keystone-moon/keystone/tests/unit/rest.py
index bfa52354..da24019f 100644
--- a/keystone-moon/keystone/tests/unit/rest.py
+++ b/keystone-moon/keystone/tests/unit/rest.py
@@ -13,15 +13,16 @@
# under the License.
from oslo_serialization import jsonutils
+from six.moves import http_client
import webtest
from keystone.auth import controllers as auth_controllers
-from keystone.tests import unit as tests
+from keystone.tests import unit
from keystone.tests.unit import default_fixtures
from keystone.tests.unit.ksfixtures import database
-class RestfulTestCase(tests.TestCase):
+class RestfulTestCase(unit.TestCase):
"""Performs restful tests against the WSGI app over HTTP.
This class launches public & admin WSGI servers for every test, which can
@@ -113,7 +114,7 @@ class RestfulTestCase(tests.TestCase):
example::
- self.assertResponseStatus(response, 204)
+ self.assertResponseStatus(response, http_client.NO_CONTENT)
"""
self.assertEqual(
response.status_code,
@@ -125,7 +126,8 @@ class RestfulTestCase(tests.TestCase):
"""Ensures that response headers appear as expected."""
self.assertIn('X-Auth-Token', response.headers.get('Vary'))
- def assertValidErrorResponse(self, response, expected_status=400):
+ def assertValidErrorResponse(self, response,
+ expected_status=http_client.BAD_REQUEST):
"""Verify that the error response is valid.
Subclasses can override this function based on the expected response.
@@ -184,7 +186,8 @@ class RestfulTestCase(tests.TestCase):
self._from_content_type(response, content_type=response_content_type)
# we can save some code & improve coverage by always doing this
- if method != 'HEAD' and response.status_code >= 400:
+ if (method != 'HEAD' and
+ response.status_code >= http_client.BAD_REQUEST):
self.assertValidErrorResponse(response)
# Contains the decoded response.body