summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDolph Mathews <dolph.mathews@gmail.com>2012-03-25 11:40:44 -0700
committerDolph Mathews <dolph.mathews@gmail.com>2012-03-27 18:48:15 -0700
commita9c6fb1d39f84f79f97333f59ef757cfd9dc8fd2 (patch)
treec52326ce47c1146d5c0e1c275d578488dae0cf72
parenta0b8f5412b69316611b009099151995714eabff4 (diff)
ec2-credential-crud 404 (bug 963056)
ec2-credential-create ec2-credential-delete ec2-credential-get ec2-credential-list Change-Id: If8bfb77017f55c24738baf18b937c78b179831e5
-rw-r--r--keystone/contrib/ec2/core.py2
-rw-r--r--tests/test_keystoneclient.py35
2 files changed, 37 insertions, 0 deletions
diff --git a/keystone/contrib/ec2/core.py b/keystone/contrib/ec2/core.py
index 80604c59..4449b6bb 100644
--- a/keystone/contrib/ec2/core.py
+++ b/keystone/contrib/ec2/core.py
@@ -239,6 +239,7 @@ class Ec2Controller(wsgi.Application):
"""
if not self._is_admin(context):
self._assert_identity(context, user_id)
+ self._assert_valid_user_id(context, user_id)
creds = self._get_credentials(context, credential_id)
return {'credential': creds}
@@ -256,6 +257,7 @@ class Ec2Controller(wsgi.Application):
self._assert_identity(context, user_id)
self._assert_owner(context, user_id, credential_id)
+ self._assert_valid_user_id(context, user_id)
self._get_credentials(context, credential_id)
return self.ec2_api.delete_credential(context, credential_id)
diff --git a/tests/test_keystoneclient.py b/tests/test_keystoneclient.py
index d18ba90d..95a06ecb 100644
--- a/tests/test_keystoneclient.py
+++ b/tests/test_keystoneclient.py
@@ -481,6 +481,41 @@ class KeystoneClientTests(object):
creds = client.ec2.list(user_id=self.user_foo['id'])
self.assertEquals(creds, [])
+ def test_ec2_credentials_create_404(self):
+ from keystoneclient import exceptions as client_exceptions
+ client = self.get_client()
+ self.assertRaises(client_exceptions.NotFound,
+ client.ec2.create,
+ user_id=uuid.uuid4().hex,
+ tenant_id=self.tenant_bar['id'])
+ self.assertRaises(client_exceptions.NotFound,
+ client.ec2.create,
+ user_id=self.user_foo['id'],
+ tenant_id=uuid.uuid4().hex)
+
+ def test_ec2_credentials_delete_404(self):
+ from keystoneclient import exceptions as client_exceptions
+ client = self.get_client()
+ self.assertRaises(client_exceptions.NotFound,
+ client.ec2.delete,
+ user_id=uuid.uuid4().hex,
+ access=uuid.uuid4().hex)
+
+ def test_ec2_credentials_get_404(self):
+ from keystoneclient import exceptions as client_exceptions
+ client = self.get_client()
+ self.assertRaises(client_exceptions.NotFound,
+ client.ec2.get,
+ user_id=uuid.uuid4().hex,
+ access=uuid.uuid4().hex)
+
+ def test_ec2_credentials_list_404(self):
+ from keystoneclient import exceptions as client_exceptions
+ client = self.get_client()
+ self.assertRaises(client_exceptions.NotFound,
+ client.ec2.list,
+ user_id=uuid.uuid4().hex)
+
def test_ec2_credentials_list_user_forbidden(self):
from keystoneclient import exceptions as client_exceptions