mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Merge pull request #1481 from MVrachev/fix-role-keyids-order
Metadata API: preserve Role.keyids order
This commit is contained in:
commit
23e4f5cdcc
2 changed files with 2 additions and 1 deletions
|
|
@ -141,6 +141,7 @@ def test_invalid_role_serialization(self, test_case_data: Dict[str, str]):
|
|||
|
||||
valid_roles: DataSet = {
|
||||
"all": '{"keyids": ["keyid"], "threshold": 3}',
|
||||
"many keyids": '{"keyids": ["a", "b", "c", "d", "e"], "threshold": 1}',
|
||||
"unrecognized field": '{"keyids": ["keyid"], "threshold": 3, "foo": "bar"}',
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -614,7 +614,7 @@ def from_dict(cls, role_dict: Dict[str, Any]) -> "Role":
|
|||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Returns the dictionary representation of self."""
|
||||
return {
|
||||
"keyids": list(self.keyids),
|
||||
"keyids": sorted(self.keyids),
|
||||
"threshold": self.threshold,
|
||||
**self.unrecognized_fields,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue