Skip to content

Commit 0b54caf

Browse files
author
Jussi Kukkonen
authored
Merge pull request #1415 from MVrachev/targets-optional
new API: make sure targets in Targets can be empty
2 parents d9a928e + 737c249 commit 0b54caf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/test_api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,13 @@ def test_metadata_targets(self):
585585
targets.signed.targets[filename].to_dict(), fileinfo.to_dict()
586586
)
587587

588+
# Test from_dict/to_dict Targets with empty targets.
589+
targets_dict = copy.deepcopy(targets.to_dict())
590+
targets_dict["signed"]["targets"] = {}
591+
tmp_dict = copy.deepcopy(targets_dict["signed"])
592+
targets_obj = Targets.from_dict(tmp_dict)
593+
self.assertEqual(targets_dict["signed"], targets_obj.to_dict())
594+
588595
# Test from_dict/to_dict Targets without delegations
589596
targets_dict = targets.to_dict()
590597
del targets_dict["signed"]["delegations"]

0 commit comments

Comments
 (0)