Skip to content

Commit

Permalink
Merge branch 'release-1.12.47'
Browse files Browse the repository at this point in the history
* release-1.12.47:
  Bumping version to 1.12.47
  Add changelog entries from botocore
  Add check for ServiceAction and test cases
  Handle positional argument in resource batch action
  • Loading branch information
aws-sdk-python-automation committed Apr 27, 2020
2 parents f962555 + 3a196e0 commit 2f0380d
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 5 deletions.
27 changes: 27 additions & 0 deletions .changes/1.12.47.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[
{
"category": "Resource",
"description": "fixes `#2361 <https://github.com/boto/boto3/issues/2361>`__",
"type": "bugfix"
},
{
"category": "``dms``",
"description": "[``botocore``] Update dms client to latest version",
"type": "api-change"
},
{
"category": "``dataexchange``",
"description": "[``botocore``] Update dataexchange client to latest version",
"type": "api-change"
},
{
"category": "``accessanalyzer``",
"description": "[``botocore``] Update accessanalyzer client to latest version",
"type": "api-change"
},
{
"category": "``sagemaker``",
"description": "[``botocore``] Update sagemaker client to latest version",
"type": "api-change"
}
]
10 changes: 10 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
CHANGELOG
=========

1.12.47
=======

* bugfix:Resource: fixes `#2361 <https://github.com/boto/boto3/issues/2361>`__
* api-change:``dms``: [``botocore``] Update dms client to latest version
* api-change:``dataexchange``: [``botocore``] Update dataexchange client to latest version
* api-change:``accessanalyzer``: [``botocore``] Update accessanalyzer client to latest version
* api-change:``sagemaker``: [``botocore``] Update sagemaker client to latest version


1.12.46
=======

Expand Down
2 changes: 1 addition & 1 deletion boto3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


__author__ = 'Amazon Web Services'
__version__ = '1.12.46'
__version__ = '1.12.47'


# The default Boto3 session; autoloaded when needed.
Expand Down
4 changes: 2 additions & 2 deletions boto3/resources/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def __call__(self, parent, *args, **kwargs):
logger.debug('Calling %s:%s with %r', parent.meta.service_name,
operation_name, params)

response = getattr(parent.meta.client, operation_name)(**params)
response = getattr(parent.meta.client, operation_name)(*args, **params)

logger.debug('Response: %r', response)

Expand Down Expand Up @@ -149,7 +149,7 @@ def __call__(self, parent, *args, **kwargs):
logger.debug('Calling %s:%s with %r',
service_name, operation_name, params)

response = getattr(client, operation_name)(**params)
response = getattr(client, operation_name)(*args, **params)

logger.debug('Response: %r', response)

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ universal = 1

[metadata]
requires-dist =
botocore>=1.15.46,<1.16.0
botocore>=1.15.47,<1.16.0
jmespath>=0.7.1,<1.0.0
s3transfer>=0.3.0,<0.4.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


requires = [
'botocore>=1.15.46,<1.16.0',
'botocore>=1.15.47,<1.16.0',
'jmespath>=0.7.1,<1.0.0',
's3transfer>=0.3.0,<0.4.0'
]
Expand Down
42 changes: 42 additions & 0 deletions tests/unit/resources/test_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,21 @@ def test_service_action_calls_resource_handler(self, handler_mock, params_mock):
operation_name='GetFrobs'
)

def test_service_action_call_positional_argument(self):
def _api_call(*args, **kwargs):
if args:
raise TypeError(
"%s() only accepts keyword arguments." % 'get_frobs')

resource = mock.Mock()
resource.meta = ResourceMeta('test', client=mock.Mock())
resource.meta.client.get_frobs = _api_call

action = ServiceAction(self.action)

with self.assertRaises(TypeError):
action(resource, 'item1')


class TestWaiterActionCall(BaseTestCase):
def setUp(self):
Expand Down Expand Up @@ -274,3 +289,30 @@ def side_effect(resource, model, params=None, index=None):
crp_mock.assert_called_with(item, model.request,
params={'foo': 'bar'}, index=0)
client.get_frobs.assert_called_with(foo='bar')

@mock.patch('boto3.resources.action.create_request_parameters')
def test_batch_action_with_positional_argument(self, crp_mock):
def side_effect(resource, model, params=None, index=None):
params['foo'] = 'bar'

def _api_call(*args, **kwargs):
if args:
raise TypeError(
"%s() only accepts keyword arguments." % 'get_frobs')

crp_mock.side_effect = side_effect

client = mock.Mock()
client.get_frobs = _api_call

item = mock.Mock()
item.meta = ResourceMeta('test', client=client)

collection = mock.Mock()
collection.pages.return_value = [[item]]

model = self.model
action = BatchAction(model)

with self.assertRaises(TypeError):
action(collection, 'item1')

0 comments on commit 2f0380d

Please sign in to comment.