"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/tests/unit/test_v3.py" between
keystone-16.0.1.tar.gz and keystone-17.0.0.tar.gz

About: OpenStack Keystone (Core Service: Identity) provides an authentication and authorization service for other OpenStack services. Provides a catalog of endpoints for all OpenStack services.
The "Ussuri" series (latest release).

test_v3.py  (keystone-16.0.1):test_v3.py  (keystone-17.0.0)
skipping to change at line 18 skipping to change at line 18
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import datetime import datetime
import uuid import uuid
import http.client
import oslo_context.context import oslo_context.context
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from six.moves import http_client
from testtools import matchers from testtools import matchers
import webtest import webtest
from keystone.common import authorization from keystone.common import authorization
from keystone.common import cache from keystone.common import cache
from keystone.common import provider_api from keystone.common import provider_api
from keystone.common.validation import validators from keystone.common.validation import validators
from keystone import exception from keystone import exception
from keystone.resource.backends import base as resource_base from keystone.resource.backends import base as resource_base
from keystone.server.flask.request_processing.middleware import auth_context from keystone.server.flask.request_processing.middleware import auth_context
skipping to change at line 443 skipping to change at line 443
} }
} }
}) })
return r.headers.get('X-Subject-Token') return r.headers.get('X-Subject-Token')
def get_requested_token(self, auth): def get_requested_token(self, auth):
"""Request the specific token we want.""" """Request the specific token we want."""
r = self.v3_create_token(auth) r = self.v3_create_token(auth)
return r.headers.get('X-Subject-Token') return r.headers.get('X-Subject-Token')
def v3_create_token(self, auth, expected_status=http_client.CREATED): def v3_create_token(self, auth, expected_status=http.client.CREATED):
return self.admin_request(method='POST', return self.admin_request(method='POST',
path='/v3/auth/tokens', path='/v3/auth/tokens',
body=auth, body=auth,
expected_status=expected_status) expected_status=expected_status)
def v3_noauth_request(self, path, **kwargs): def v3_noauth_request(self, path, **kwargs):
# request does not require auth token header # request does not require auth token header
path = '/v3' + path path = '/v3' + path
return self.admin_request(path=path, **kwargs) return self.admin_request(path=path, **kwargs)
skipping to change at line 472 skipping to change at line 472
if auth_arg: if auth_arg:
token = self.get_requested_token(auth_arg) token = self.get_requested_token(auth_arg)
else: else:
token = kwargs.pop('token', None) token = kwargs.pop('token', None)
if not token: if not token:
token = self.get_scoped_token() token = self.get_scoped_token()
path = '/v3' + path path = '/v3' + path
return self.admin_request(path=path, token=token, **kwargs) return self.admin_request(path=path, token=token, **kwargs)
def get(self, path, expected_status=http_client.OK, **kwargs): def get(self, path, expected_status=http.client.OK, **kwargs):
return self.v3_request(path, method='GET', return self.v3_request(path, method='GET',
expected_status=expected_status, **kwargs) expected_status=expected_status, **kwargs)
def head(self, path, expected_status=http_client.NO_CONTENT, **kwargs): def head(self, path, expected_status=http.client.NO_CONTENT, **kwargs):
r = self.v3_request(path, method='HEAD', r = self.v3_request(path, method='HEAD',
expected_status=expected_status, **kwargs) expected_status=expected_status, **kwargs)
self.assertEqual(b'', r.body) self.assertEqual(b'', r.body)
return r return r
def post(self, path, expected_status=http_client.CREATED, **kwargs): def post(self, path, expected_status=http.client.CREATED, **kwargs):
return self.v3_request(path, method='POST', return self.v3_request(path, method='POST',
expected_status=expected_status, **kwargs) expected_status=expected_status, **kwargs)
def put(self, path, expected_status=http_client.NO_CONTENT, **kwargs): def put(self, path, expected_status=http.client.NO_CONTENT, **kwargs):
return self.v3_request(path, method='PUT', return self.v3_request(path, method='PUT',
expected_status=expected_status, **kwargs) expected_status=expected_status, **kwargs)
def patch(self, path, expected_status=http_client.OK, **kwargs): def patch(self, path, expected_status=http.client.OK, **kwargs):
return self.v3_request(path, method='PATCH', return self.v3_request(path, method='PATCH',
expected_status=expected_status, **kwargs) expected_status=expected_status, **kwargs)
def delete(self, path, expected_status=http_client.NO_CONTENT, **kwargs): def delete(self, path, expected_status=http.client.NO_CONTENT, **kwargs):
return self.v3_request(path, method='DELETE', return self.v3_request(path, method='DELETE',
expected_status=expected_status, **kwargs) expected_status=expected_status, **kwargs)
def assertValidErrorResponse(self, r): def assertValidErrorResponse(self, r):
resp = r.result resp = r.result
self.assertIsNotNone(resp.get('error')) self.assertIsNotNone(resp.get('error'))
self.assertIsNotNone(resp['error'].get('code')) self.assertIsNotNone(resp['error'].get('code'))
self.assertIsNotNone(resp['error'].get('title')) self.assertIsNotNone(resp['error'].get('title'))
self.assertIsNotNone(resp['error'].get('message')) self.assertIsNotNone(resp['error'].get('message'))
self.assertEqual(int(resp['error']['code']), r.status_code) self.assertEqual(int(resp['error']['code']), r.status_code)
 End of changes. 9 change blocks. 
8 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)