"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/tests/unit/test_contrib_s3_core.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_contrib_s3_core.py  (keystone-16.0.1):test_contrib_s3_core.py  (keystone-17.0.0)
skipping to change at line 20 skipping to change at line 20
# 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 base64 import base64
import hashlib import hashlib
import hmac import hmac
import uuid import uuid
from six.moves import http_client import http.client
from keystone.api import s3tokens from keystone.api import s3tokens
from keystone.common import provider_api from keystone.common import provider_api
from keystone import exception from keystone import exception
from keystone.tests import unit from keystone.tests import unit
from keystone.tests.unit import test_v3 from keystone.tests.unit import test_v3
PROVIDERS = provider_api.ProviderAPIs PROVIDERS = provider_api.ProviderAPIs
class S3ContribCore(test_v3.RestfulTestCase): class S3ContribCore(test_v3.RestfulTestCase):
skipping to change at line 52 skipping to change at line 52
sts = 'string to sign' # opaque string from swift3 sts = 'string to sign' # opaque string from swift3
sig = hmac.new(self.cred_blob['secret'].encode('ascii'), sig = hmac.new(self.cred_blob['secret'].encode('ascii'),
sts.encode('ascii'), hashlib.sha1).digest() sts.encode('ascii'), hashlib.sha1).digest()
resp = self.post( resp = self.post(
'/s3tokens', '/s3tokens',
body={'credentials': { body={'credentials': {
'access': self.cred_blob['access'], 'access': self.cred_blob['access'],
'signature': base64.b64encode(sig).strip(), 'signature': base64.b64encode(sig).strip(),
'token': base64.b64encode(sts.encode('ascii')).strip(), 'token': base64.b64encode(sts.encode('ascii')).strip(),
}}, }},
expected_status=http_client.OK) expected_status=http.client.OK)
self.assertValidProjectScopedTokenResponse(resp, self.user, self.assertValidProjectScopedTokenResponse(resp, self.user,
forbid_token_id=True) forbid_token_id=True)
def test_bad_request(self): def test_bad_request(self):
self.post( self.post(
'/s3tokens', '/s3tokens',
body={}, body={},
expected_status=http_client.BAD_REQUEST) expected_status=http.client.BAD_REQUEST)
self.post( self.post(
'/s3tokens', '/s3tokens',
body="not json", body="not json",
expected_status=http_client.BAD_REQUEST) expected_status=http.client.BAD_REQUEST)
self.post( self.post(
'/s3tokens', '/s3tokens',
expected_status=http_client.BAD_REQUEST) expected_status=http.client.BAD_REQUEST)
def test_bad_response(self): def test_bad_response(self):
self.post( self.post(
'/s3tokens', '/s3tokens',
body={'credentials': { body={'credentials': {
'access': self.cred_blob['access'], 'access': self.cred_blob['access'],
'signature': base64.b64encode(b'totally not the sig').strip(), 'signature': base64.b64encode(b'totally not the sig').strip(),
'token': base64.b64encode(b'string to sign').strip(), 'token': base64.b64encode(b'string to sign').strip(),
}}, }},
expected_status=http_client.UNAUTHORIZED) expected_status=http.client.UNAUTHORIZED)
def test_good_signature_v1(self): def test_good_signature_v1(self):
creds_ref = {'secret': creds_ref = {'secret':
u'b121dd41cdcc42fe9f70e572e84295aa'} u'b121dd41cdcc42fe9f70e572e84295aa'}
credentials = {'token': credentials = {'token':
'UFVUCjFCMk0yWThBc2dUcGdBbVk3UGhDZmc9PQphcHB' 'UFVUCjFCMk0yWThBc2dUcGdBbVk3UGhDZmc9PQphcHB'
'saWNhdGlvbi9vY3RldC1zdHJlYW0KVHVlLCAxMSBEZWMgMjAxM' 'saWNhdGlvbi9vY3RldC1zdHJlYW0KVHVlLCAxMSBEZWMgMjAxM'
'iAyMTo0MTo0MSBHTVQKL2NvbnRfczMvdXBsb2FkZWRfZnJ' 'iAyMTo0MTo0MSBHTVQKL2NvbnRfczMvdXBsb2FkZWRfZnJ'
'vbV9zMy50eHQ=', 'vbV9zMy50eHQ=',
'signature': 'IL4QLcLVaYgylF9iHj6Wb8BGZsw='} 'signature': 'IL4QLcLVaYgylF9iHj6Wb8BGZsw='}
 End of changes. 6 change blocks. 
6 lines changed or deleted 6 lines changed or added

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