Skip to content

Commit

Permalink
Merge pull request aws#1488 from rayluo/bugfix-adjust-for-botocore-ti…
Browse files Browse the repository at this point in the history
…meout

Change test cases to accommodate botocore timeouts
  • Loading branch information
rayluo committed Sep 2, 2015
2 parents ed610bc + 83a4854 commit 32c12c6
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions tests/unit/test_clidriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,37 +620,34 @@ def test_aws_with_endpoint_url(self):
self.assert_params_for_cmd(
'ec2 describe-instances --endpoint-url https://foobar.com/',
expected_rc=0)
self.create_endpoint.assert_called_with(
mock.ANY, 'us-east-1', verify=None, endpoint_url='https://foobar.com/',
is_secure=True, response_parser_factory=mock.ANY)
self.assertEqual(self.create_endpoint.call_args[1]['endpoint_url'],
'https://foobar.com/')

def test_aws_with_region(self):
self.assert_params_for_cmd(
'ec2 describe-instances --region us-west-2',
expected_rc=0)
self.create_endpoint.assert_called_with(
mock.ANY, 'us-west-2', verify=None, endpoint_url=None,
is_secure=True, response_parser_factory=mock.ANY)
self.assertEqual(self.create_endpoint.call_args[0],
(mock.ANY, 'us-west-2'))

def test_aws_with_verify_false(self):
self.assert_params_for_cmd(
'ec2 describe-instances --region us-east-1 --no-verify-ssl',
expected_rc=0)
# Because we used --no-verify-ssl, create_endpoint should be
# called with verify=False
self.create_endpoint.assert_called_with(
mock.ANY, 'us-east-1', verify=False, endpoint_url=None,
is_secure=True, response_parser_factory=mock.ANY)
call_args = self.create_endpoint.call_args
self.assertEqual(call_args[0], (mock.ANY, 'us-east-1'))
self.assertFalse(call_args[1]['verify'])

def test_aws_with_cacert_env_var(self):
self.environ['AWS_CA_BUNDLE'] = '/path/cacert.pem'
self.assert_params_for_cmd(
'ec2 describe-instances --region us-east-1',
expected_rc=0)
self.create_endpoint.assert_called_with(
mock.ANY, 'us-east-1', verify='/path/cacert.pem',
endpoint_url=None, is_secure=True,
response_parser_factory=mock.ANY)
call_args = self.create_endpoint.call_args
self.assertEqual(call_args[0], (mock.ANY, 'us-east-1'))
self.assertEqual(call_args[1]['verify'], '/path/cacert.pem')


class TestHTTPParamFileDoesNotExist(BaseAWSCommandParamsTest):
Expand Down

0 comments on commit 32c12c6

Please sign in to comment.