Expose a bug when authorize request token
Keystone raise 500 error when authorize request token with invalid body. This patch expose the bug that keystone raise 500 error instead of 400 in this case. Change-Id: I3ddeebf8a46467ed090d8831fd8cf35edee7ce04 Partial-Bug: #1736875
This commit is contained in:
parent
ebb41970bf
commit
af151559ee
|
@ -35,6 +35,7 @@ from keystone.tests.unit.common import test_notifications
|
|||
from keystone.tests.unit import ksfixtures
|
||||
from keystone.tests.unit.ksfixtures import temporaryfile
|
||||
from keystone.tests.unit import test_v3
|
||||
from keystone.tests.unit import utils as test_utils
|
||||
|
||||
|
||||
CONF = keystone.conf.CONF
|
||||
|
@ -719,6 +720,23 @@ class MaliciousOAuth1Tests(OAuth1Tests):
|
|||
body = {'roles': [{'id': self.role_id}]}
|
||||
self.put(url, body=body, expected_status=http_client.NOT_FOUND)
|
||||
|
||||
@test_utils.wip('Waiting on validation to be added from fixing bug '
|
||||
'1736875')
|
||||
def test_bad_request_body_when_authorize(self):
|
||||
consumer = self._create_single_consumer()
|
||||
consumer_id = consumer['id']
|
||||
consumer_secret = consumer['secret']
|
||||
consumer = {'key': consumer_id, 'secret': consumer_secret}
|
||||
url, headers = self._create_request_token(consumer, self.project_id)
|
||||
content = self.post(
|
||||
url, headers=headers,
|
||||
response_content_type='application/x-www-form-urlencoded')
|
||||
credentials = _urllib_parse_qs_text_keys(content.result)
|
||||
request_key = credentials['oauth_token'][0]
|
||||
url = self._authorize_request_token(request_key)
|
||||
bad_body = {'roles': [{'fake_key': 'fake_value'}]}
|
||||
self.put(url, body=bad_body, expected_status=http_client.BAD_REQUEST)
|
||||
|
||||
def test_bad_consumer_id(self):
|
||||
consumer = self._create_single_consumer()
|
||||
consumer_id = uuid.uuid4().hex
|
||||
|
|
Loading…
Reference in New Issue