Make sure to verify service names on key creation

This commit is contained in:
Joseph Schorr 2016-04-14 16:56:15 -04:00 committed by Jimmy Zelinskie
parent dc9bcec9ce
commit 28a80ef6a9
3 changed files with 24 additions and 1 deletions

View file

@ -233,6 +233,13 @@ class KeyServerTestCase(EndpointTestCase):
payload = self._get_test_jwt_payload()
token = jwt.encode(payload, private_key.exportKey('PEM'), 'RS256')
# Invalid service name should yield a 400.
self.putResponse('key_server.put_service_key', service='sample service', kid='kid420',
headers={
'Authorization': 'Bearer %s' % token,
'Content-Type': 'application/json',
}, data=jwk, expected_code=400)
# Publish a new key
with assert_action_logged('service_key_create'):
self.putResponse('key_server.put_service_key', service='sample_service', kid='kid420',