Skip to content

Metadata API: Remove Signed.bump_expiration() method#1743

Merged
joshuagl merged 2 commits intotheupdateframework:developfrom
lukpueh:rm-metadata-api-bump_expiration
Jan 5, 2022
Merged

Metadata API: Remove Signed.bump_expiration() method#1743
joshuagl merged 2 commits intotheupdateframework:developfrom
lukpueh:rm-metadata-api-bump_expiration

Conversation

@lukpueh
Copy link
Member

@lukpueh lukpueh commented Dec 22, 2021

Fixes #1727

Description of the changes being introduced by the pull request:

Remove bump_expiration() method, which is unlikely to be used as is, i.e. bump to "current expiration date plus delta". A more realistic use case is to bump to "now plus delta" (see #1727 for details).

Moreover, bump_expiration can either way easily be replaced by a one-liner expression using the 'datetime' module. A corresponding code snippet is added to the expires property's docstring.
Note: expires became a property with a millisec-removing setter (for spec conformance) in #1712, which further reduces the need for a convenience bump_expiration method.

This patch also

  • removes a related unit test and updates another one, and
  • updates rtd/sphinx config to display inherited members, most notably the expires property with said code snippet (see e.g. Root.expires)

Please verify and check that the pull request fulfills the following
requirements
:

  • The code follows the Code Style Guidelines
  • Tests have been added for the bug fix or new feature
  • Docs have been added for the bug fix or new feature

Lukas Puehringer added 2 commits December 22, 2021 11:40
Remove `bump_expiration()` method, which is unlikely to be used as
is, i.e.  bump to "current expiration date plus delta". A more
realistic use case is to bump to "now plus delta" (see theupdateframework#1727 for
details).

Moreover, bump_expiration can either way easily be replaced by a
one-liner expression using the 'datetime' module. A corresponding
code snippet is added to the `expires` property's docstring.  Note:
`expires` became a property with a millisec-removing setter (for
spec conformance) in  theupdateframework#1712, which further reduces the need for a
convenience bump_expiration method.

This patch also removes a related unit test and updates another
one.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
Update sphinx/rtd conf to display inherited members. This is
enabled specifically for the newly added `expires` property,
which has a useful code snippet in the docstring.

We don't display
- them on the tuf.api automodule overview page (avoid duplicates)
- members inherited from the built-in Exception class

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
@coveralls
Copy link

coveralls commented Dec 22, 2021

Pull Request Test Coverage Report for Build 1610942226

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.0%) to 98.691%

Totals Coverage Status
Change from base Build 1606187413: 1.0%
Covered Lines: 3932
Relevant Lines: 3954

💛 - Coveralls

Copy link
Collaborator

@MVrachev MVrachev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@joshuagl joshuagl merged commit 537a019 into theupdateframework:develop Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Metadata API: rethink the expiry related API

4 participants