Skip to content

Commit 440040c

Browse files
committed
Remove filename argument from Targets.update()
After the addition of "path" argument in the TargetFile class the filename argument in Targets.update() became redundant. Signed-off-by: Martin Vrachev <[email protected]>
1 parent da864ea commit 440040c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tests/test_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ def test_metadata_targets(self):
546546
targets.signed.targets[filename].to_dict(), fileinfo.to_dict()
547547
)
548548
# Update an already existing fileinfo
549-
targets.signed.update(filename, fileinfo)
549+
targets.signed.update(fileinfo)
550550
# Verify that data is updated
551551
self.assertEqual(
552552
targets.signed.targets[filename].to_dict(), fileinfo.to_dict()

tuf/api/metadata.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,6 @@ def to_dict(self) -> Dict[str, Any]:
12531253
return targets_dict
12541254

12551255
# Modification.
1256-
def update(self, filename: str, fileinfo: TargetFile) -> None:
1256+
def update(self, fileinfo: TargetFile) -> None:
12571257
"""Assigns passed target file info to meta dict."""
1258-
self.targets[filename] = fileinfo
1258+
self.targets[fileinfo.path] = fileinfo

0 commit comments

Comments
 (0)