Skip to content

Commit

Permalink
Merge pull request #1415 from MVrachev/targets-optional
Browse files Browse the repository at this point in the history
new API: make sure targets in Targets can be empty
  • Loading branch information
Jussi Kukkonen committed Jun 2, 2021
2 parents d9a928e + 737c249 commit 0b54caf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,13 @@ def test_metadata_targets(self):
targets.signed.targets[filename].to_dict(), fileinfo.to_dict()
)

# Test from_dict/to_dict Targets with empty targets.
targets_dict = copy.deepcopy(targets.to_dict())
targets_dict["signed"]["targets"] = {}
tmp_dict = copy.deepcopy(targets_dict["signed"])
targets_obj = Targets.from_dict(tmp_dict)
self.assertEqual(targets_dict["signed"], targets_obj.to_dict())

# Test from_dict/to_dict Targets without delegations
targets_dict = targets.to_dict()
del targets_dict["signed"]["delegations"]
Expand Down

0 comments on commit 0b54caf

Please sign in to comment.