-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for Updater input validation #1758
Add tests for Updater input validation #1758
Conversation
Pull Request Test Coverage Report for Build 1778436409Warning: 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
💛 - Coveralls |
56e6da5
to
b754d98
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I like as a result of this pr is that we can see what exceptions are thrown by different Updater public API functions.
I am planning on fixing the TODO
items related to Raises
documentation in the public function docstrings from tuf/ngclient/updater.py
.
tests/test_updater_validation.py
Outdated
|
||
updater = self._new_updater_with_targets_setup() | ||
target_info = updater.get_targetinfo("targetpath") | ||
with self.assertRaises(securesystemslib.exceptions.StorageError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good find, another non-documented Securesystemslib error.. we can handle this in a separate issue though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b754d98
to
5479563
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left some specific comments in source.
A general comment on testing any download failures or Fetcher errors: They seem like good new ideas but it might be more useful to add those into test_updater_ng.py
as testing this aspect with Repositorysimulator is going to be quite artificial: there's not even a webserver involved...
I think that applies to second half of test_empty_targetinfo_validation
and test_invalid_target_base_url
.
5479563
to
12466d6
Compare
12466d6
to
7e86e13
Compare
Linter is failing for |
7e86e13
to
09fffae
Compare
@MVrachev thank you for addressing the issue! I just pushed an update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think two of the tests do not give us much value and could be removed.
Other tests look good... Although we're left with just two short local storage tests in the new file: maybe it's not worth it to add 50 lines of setup code for two tests? We could just move those two to test_updater_ng.py
?
This test covers `targetinfo`, `target_path`, `target_base_url`, `metadata_dir` and `filepath` input validation of the `Updater` methods Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>
09fffae
to
e26363c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving, these look good.
I left this question that wasn't responded to though:
...we're left with just two short local storage tests in the new file: maybe it's not worth it to add 50 lines of setup code for two tests? We could just move those two to test_updater_ng.py?
no need to do it now, just wondering about that
This test covers
targetinfo
,target_path
,target_base_url
,metadata_dir
andfilepath
input validation of theUpdater
methods
Fixes #1644