Avoid using falsy tests for None#1390
Merged
jku merged 2 commits intotheupdateframework:developfrom May 18, 2021
Merged
Conversation
A DelegatedRole with paths=[] fails to serialize correctly (paths is not included in the output json). Fix the issue, modify tests to notice a regression. Fixes theupdateframework#1389 Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
Member
Author
|
The fact that these issues are found tells me our testing is not adequate. I'll file an issue on that, if one does not exist: #1391 |
sechkova
reviewed
May 14, 2021
Contributor
sechkova
left a comment
There was a problem hiding this comment.
One comment about a test case, otherwise LGTM.
Use either "if X is not None:" or a try-except instead of a "if X:". I believe Targets.from_dict() was not really broken with previous code but it looks suspicious and did fail the added test with a strange exception: I expect the from_dict() methods to mainly fail with KeyErrors, ValueErrors or AttributeErrors if file format structure is incorrect. Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
73a8f24 to
14f5957
Compare
sechkova
approved these changes
May 14, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix a bug in DelegatedRole serialization and change all "falsy" object comparisons to something else.