diff options
author | Dolph Mathews <dolph.mathews@gmail.com> | 2012-06-03 11:00:54 -0500 |
---|---|---|
committer | Dolph Mathews <dolph.mathews@gmail.com> | 2012-06-03 12:08:44 -0500 |
commit | 1d146f5c32e58a73a677d308370f147a3271c2cb (patch) | |
tree | 25c6e7879e95aa4b3478e966cd51bb58eb6e3697 /tests/test_content_types.py | |
parent | 4bfa203ac433da1537d8da963bd7554d36f2add7 (diff) | |
download | keystone-1d146f5c32e58a73a677d308370f147a3271c2cb.tar.gz keystone-1d146f5c32e58a73a677d308370f147a3271c2cb.tar.xz keystone-1d146f5c32e58a73a677d308370f147a3271c2cb.zip |
Require authz for service CRUD (bug 1006822)
Change-Id: Ia90f0aa2b856b9a9874d4865fb92ee913e8125c5
Diffstat (limited to 'tests/test_content_types.py')
-rw-r--r-- | tests/test_content_types.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_content_types.py b/tests/test_content_types.py index 639a03dc..df73dff6 100644 --- a/tests/test_content_types.py +++ b/tests/test_content_types.py @@ -16,6 +16,7 @@ import httplib import json +import uuid from lxml import etree import nose.exc @@ -554,6 +555,38 @@ class JsonTestCase(RestfulTestCase, CoreApiTests): def assertValidVersionResponse(self, r): self.assertValidVersion(r.body.get('version')) + def test_service_crud_requires_auth(self): + """Service CRUD should 401 without an X-Auth-Token (bug 1006822).""" + # values here don't matter because we should 401 before they're checked + service_path = '/v2.0/OS-KSADM/services/%s' % uuid.uuid4().hex + service_body = { + 'OS-KSADM:service': { + 'name': uuid.uuid4().hex, + 'type': uuid.uuid4().hex, + }, + } + + r = self.admin_request(method='GET', + path='/v2.0/OS-KSADM/services', + expected_status=401) + self.assertValidErrorResponse(r) + + r = self.admin_request(method='POST', + path='/v2.0/OS-KSADM/services', + body=service_body, + expected_status=401) + self.assertValidErrorResponse(r) + + r = self.admin_request(method='GET', + path=service_path, + expected_status=401) + self.assertValidErrorResponse(r) + + r = self.admin_request(method='DELETE', + path=service_path, + expected_status=401) + self.assertValidErrorResponse(r) + class XmlTestCase(RestfulTestCase, CoreApiTests): xmlns = 'http://docs.openstack.org/identity/api/v2.0' |