Skip to content

Commit

Permalink
Update sts integration tests
Browse files Browse the repository at this point in the history
Also touched up endpoint code.
  • Loading branch information
kyleknap committed Feb 19, 2015
1 parent 5646598 commit 57a3240
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 0 additions & 5 deletions botocore/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,6 @@ def create_endpoint(self, service_model, region_name=None, is_secure=True,
endpoint = {'uri': endpoint_url, 'properties': {}}
else:
raise
# We only support the credentialScope.region in the properties
# bag right now, so if it's available, it will override the
# provided region name.
region_name_override = endpoint['properties'].get(
'credentialScope', {}).get('region')

region_name = self._determine_region_name(endpoint, region_name,
endpoint_url)
Expand Down
13 changes: 13 additions & 0 deletions tests/integration/test_sts.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ def setUp(self):
self.session = botocore.session.get_session()

def test_regionalized_endpoints(self):

sts = self.session.create_client('sts', region_name='ap-southeast-1')
response = sts.get_session_token()
# Do not want to be revealing any temporary keys if the assertion fails
self.assertIn('Credentials', response.keys())

# Since we have to activate STS regionalization, we will test
# that you can send an STS request to a regionalized endpoint
# by making a call with the explicitly wrong region name
Expand All @@ -36,6 +42,13 @@ def test_regionalized_endpoints_operation(self):
# but this type of integration testing (non customized) should
# be done at the botocore level.
sts = self.session.get_service('sts')

endpoint = sts.get_endpoint(region_name='ap-southeast-1')
operation = sts.get_operation('GetSessionToken')
http, response = operation.call(endpoint)
# Do not want to be revealing any temporary keys if the assertion fails
self.assertIn('Credentials', response.keys())

endpoint = sts.get_endpoint(
region_name='ap-southeast-1',
endpoint_url='https://sts.us-west-2.amazonaws.com')
Expand Down

0 comments on commit 57a3240

Please sign in to comment.