summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorUnmesh Gurjar <unmesh.gurjar@nttdata.com>2012-10-10 04:22:31 -0700
committerUnmesh Gurjar <unmesh.gurjar@nttdata.com>2012-10-25 00:27:50 -0700
commit9ee3fba769274a84ea7709aa0068c19a421dbd80 (patch)
treed5c328b56c15d3a4ecd106f06615621920551828 /tests
parent7db2f6aa595e2d1261bc59750519b59daab7ab07 (diff)
downloadkeystone-9ee3fba769274a84ea7709aa0068c19a421dbd80.tar.gz
keystone-9ee3fba769274a84ea7709aa0068c19a421dbd80.tar.xz
keystone-9ee3fba769274a84ea7709aa0068c19a421dbd80.zip
Fixes 500 err on authentication for invalid body
1. This fixes the 500 error on authentication when invalid request body is provided, a 400 Bad Request response is returned instead. 2. Also added unit test coverage. Fixes LP: #1060709 Change-Id: I7f2916e0b91de1e299d2dc7a245ff6c2bc548afd
Diffstat (limited to 'tests')
-rw-r--r--tests/test_service.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_service.py b/tests/test_service.py
index fc4e94de..979e9472 100644
--- a/tests/test_service.py
+++ b/tests/test_service.py
@@ -49,3 +49,18 @@ class TokenControllerTest(test.TestCase):
'tenantName': 'demo'}
self.assertRaises(exception.ValidationError, self.api.authenticate,
None, body_dict)
+
+ def test_authenticate_blank_request_body(self):
+ """Verify sending empty json dict raises the right exception."""
+ self.assertRaises(exception.ValidationError, self.api.authenticate,
+ None, {})
+
+ def test_authenticate_blank_auth(self):
+ """Verify sending blank 'auth' raises the right exception."""
+ self.assertRaises(exception.ValidationError, self.api.authenticate,
+ None, {'auth': {}})
+
+ def test_authenticate_invalid_auth_content(self):
+ """Verify sending invalid 'auth' raises the right exception."""
+ self.assertRaises(exception.ValidationError, self.api.authenticate,
+ None, {'auth': 'abcd'})