-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Request Serialization Protocol Tests #3378
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## update-protocol-tests #3378 +/- ##
=========================================================
- Coverage 93.08% 93.07% -0.02%
=========================================================
Files 66 66
Lines 14485 14536 +51
=========================================================
+ Hits 13483 13529 +46
- Misses 1002 1007 +5 ☔ View full report in Codecov by Sentry. |
a39d223
to
563781f
Compare
input_members = ( | ||
operation_model.input_shape.members | ||
if operation_model.input_shape | ||
else {} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible for a service to not model an input shape for their operation. As of botocore-1.36.22
there are 73 operations across 33 services that don't model an input shape. Additionally, there are 23 services that use the hostPrefix
endpoint trait.
In the case where a service operation doesn't model an input shape AND models the hostPrefix
endpoint trait, the existing logic would result in the following error:
AttributeError: 'NoneType' object has no attribute 'members'
Solution: If the operation doesn't model an input shape, return an empty members dict ({}
) and continue with normal resolution/validation.
host_prefix = self._expand_host_prefix(parameters, operation_model) | ||
if host_prefix is not None: | ||
serialized['host_prefix'] = host_prefix | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, hostPrefix expansion happens at the end of the serialize_to_request
method. In the case where no input shape is defined on the operation, serialize_to_request
returns early and fails to expand the hostPrefix.
Solution: By moving the hostPrefix expansion earlier in this method (before we check if the input shape is None), we ensure the hostPrefix is always expanded.
Summary
botocore/tests/unit/protocols/output
with new tests generated from Smithy protocol test models.botocore/tests/unit/protocols/legacy
and will continue to run for additional coverage.botocore/serialize.py
and protocol test runner inbotocore/tests/unit/test_protocols.py
for additional compliance with the smithy-generated protocol tests.