I tried to add a test for IAM roles.
Unfortunately when adding a complete response for list_roles operation I stumbled across an error.
If "AssumeRolePolicyDocument" is included in the response botocore calls json_decode_policies which results in the following error:
Traceback (most recent call last):
File "/home/tobias/work/repos/skew/tests/unit/test_arn.py", line 222, in test_iam_roles
l = list(arn)
File "/home/tobias/work/repos/skew/skew/arn/__init__.py", line 323, in __iter__
for scheme in self.scheme.enumerate(context, **self.kwargs):
File "/home/tobias/work/repos/skew/skew/arn/__init__.py", line 247, in enumerate
for provider in self._arn.provider.enumerate(
File "/home/tobias/work/repos/skew/skew/arn/__init__.py", line 232, in enumerate
for service in self._arn.service.enumerate(
File "/home/tobias/work/repos/skew/skew/arn/__init__.py", line 217, in enumerate
for region in self._arn.region.enumerate(
File "/home/tobias/work/repos/skew/skew/arn/__init__.py", line 198, in enumerate
for account in self._arn.account.enumerate(
File "/home/tobias/work/repos/skew/skew/arn/__init__.py", line 145, in enumerate
for resource in self._arn.resource.enumerate(
File "/home/tobias/work/repos/skew/skew/arn/__init__.py", line 127, in enumerate
resources.extend(resource_cls.enumerate(
File "/home/tobias/work/repos/skew/skew/resources/resource.py", line 54, in enumerate
data = client.call(enum_op, query=path, **kwargs)
File "/home/tobias/work/repos/skew/skew/awsclient.py", line 120, in call
data = results.build_full_result()
File "/home/tobias/.local/share/virtualenvs/skew-4OWl7ITO/lib/python3.8/site-packages/botocore/paginate.py", line 449, in build_full_result
for response in self:
File "/home/tobias/.local/share/virtualenvs/skew-4OWl7ITO/lib/python3.8/site-packages/botocore/paginate.py", line 255, in __iter__
response = self._make_request(current_kwargs)
File "/home/tobias/.local/share/virtualenvs/skew-4OWl7ITO/lib/python3.8/site-packages/botocore/paginate.py", line 332, in _make_request
return self._method(**current_kwargs)
File "/home/tobias/.local/share/virtualenvs/skew-4OWl7ITO/lib/python3.8/site-packages/botocore/client.py", line 316, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/home/tobias/.local/share/virtualenvs/skew-4OWl7ITO/lib/python3.8/site-packages/botocore/client.py", line 624, in _make_api_call
self.meta.events.emit(
File "/home/tobias/.local/share/virtualenvs/skew-4OWl7ITO/lib/python3.8/site-packages/botocore/hooks.py", line 356, in emit
return self._emitter.emit(aliased_event_name, **kwargs)
File "/home/tobias/.local/share/virtualenvs/skew-4OWl7ITO/lib/python3.8/site-packages/botocore/hooks.py", line 228, in emit
return self._emit(event_name, kwargs)
File "/home/tobias/.local/share/virtualenvs/skew-4OWl7ITO/lib/python3.8/site-packages/botocore/hooks.py", line 211, in _emit
response = handler(**kwargs)
File "/home/tobias/.local/share/virtualenvs/skew-4OWl7ITO/lib/python3.8/site-packages/botocore/handlers.py", line 446, in json_decode_policies
_decode_policy_types(parsed, model.output_shape)
File "/home/tobias/.local/share/virtualenvs/skew-4OWl7ITO/lib/python3.8/site-packages/botocore/handlers.py", line 461, in _decode_policy_types
_decode_policy_types(parsed[member_name], member_shape)
File "/home/tobias/.local/share/virtualenvs/skew-4OWl7ITO/lib/python3.8/site-packages/botocore/handlers.py", line 465, in _decode_policy_types
_decode_policy_types(item, shape_member)
File "/home/tobias/.local/share/virtualenvs/skew-4OWl7ITO/lib/python3.8/site-packages/botocore/handlers.py", line 458, in _decode_policy_types
parsed[member_name] = decode_quoted_jsondoc(
File "/home/tobias/.local/share/virtualenvs/skew-4OWl7ITO/lib/python3.8/site-packages/botocore/handlers.py", line 180, in decode_quoted_jsondoc
value = json.loads(unquote(value))
File "/usr/lib/python3.8/urllib/parse.py", line 635, in unquote
string.split
AttributeError: 'dict' object has no attribute 'split'
It looks to me like the AssumeRolePolicyDocument should be a string and not a dict.
However when making a boto call to list_rolesAssumeRolePolicyDocument is a python dict, so I think my json response is valid?
Can I safely ignore this issue and change AssumeRolePolicyDocument to an escaped string containing the dict ?
I tried to add a test for IAM roles. Unfortunately when adding a complete response for
list_roles
operation I stumbled across an error. If"AssumeRolePolicyDocument"
is included in the response botocore callsjson_decode_policies
which results in the following error:It looks to me like the
AssumeRolePolicyDocument
should be a string and not a dict. However when making a boto call tolist_roles
AssumeRolePolicyDocument
is a python dict, so I think my json response is valid? Can I safely ignore this issue and changeAssumeRolePolicyDocument
to an escaped string containing the dict ?