From 440040ce981ed160188a56d87e4e0d9af9a5e496 Mon Sep 17 00:00:00 2001 From: Martin Vrachev Date: Tue, 17 Aug 2021 13:57:38 +0300 Subject: [PATCH] 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 --- tests/test_api.py | 2 +- tuf/api/metadata.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index 32bad6e6a7..7eef20d251 100755 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -546,7 +546,7 @@ def test_metadata_targets(self): targets.signed.targets[filename].to_dict(), fileinfo.to_dict() ) # Update an already existing fileinfo - targets.signed.update(filename, fileinfo) + targets.signed.update(fileinfo) # Verify that data is updated self.assertEqual( targets.signed.targets[filename].to_dict(), fileinfo.to_dict() diff --git a/tuf/api/metadata.py b/tuf/api/metadata.py index cc2498583a..d01cc4aa19 100644 --- a/tuf/api/metadata.py +++ b/tuf/api/metadata.py @@ -1253,6 +1253,6 @@ def to_dict(self) -> Dict[str, Any]: return targets_dict # Modification. - def update(self, filename: str, fileinfo: TargetFile) -> None: + def update(self, fileinfo: TargetFile) -> None: """Assigns passed target file info to meta dict.""" - self.targets[filename] = fileinfo + self.targets[fileinfo.path] = fileinfo