Skip to content

Commit

Permalink
service-crud 404 (bug 963056)
Browse files Browse the repository at this point in the history
service-delete
service-get

Change-Id: Ifecf4c74abf408b009a783a9d7be0e98219e0fe4
  • Loading branch information
dolph committed Mar 28, 2012
1 parent 16caf20 commit a0b8f54
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 4 additions & 1 deletion keystone/catalog/core.py
Expand Up @@ -133,7 +133,10 @@ def get_service(self, context, service_id):
return {'OS-KSADM:service': service_ref}

def delete_service(self, context, service_id):
service_ref = self.catalog_api.delete_service(context, service_id)
service_ref = self.catalog_api.get_service(context, service_id)
if not service_ref:
raise exception.ServiceNotFound(service_id=service_id)
self.catalog_api.delete_service(context, service_id)

def create_service(self, context, OS_KSADM_service):
service_id = uuid.uuid4().hex
Expand Down
14 changes: 14 additions & 0 deletions tests/test_keystoneclient.py
Expand Up @@ -550,6 +550,20 @@ def test_service_crud(self):
services = [x for x in client.services.list() if x.id == service.id]
self.assertEquals(len(services), 0)

def test_service_delete_404(self):
from keystoneclient import exceptions as client_exceptions
client = self.get_client(admin=True)
self.assertRaises(client_exceptions.NotFound,
client.services.delete,
id=uuid.uuid4().hex)

def test_service_get_404(self):
from keystoneclient import exceptions as client_exceptions
client = self.get_client(admin=True)
self.assertRaises(client_exceptions.NotFound,
client.services.get,
id=uuid.uuid4().hex)

def test_admin_requires_adminness(self):
from keystoneclient import exceptions as client_exceptions
# FIXME(ja): this should be Unauthorized
Expand Down

0 comments on commit a0b8f54

Please sign in to comment.