python-tuf
python-tuf copied to clipboard
Add test coverage for delegated hash bins target download
This change adds tests coverage for path_hash_prefixes and
verifies that role names matching specific prefixed successfully
find and download the corresponding metadata files and do not
succeed to find existing, but non-matching files
Fixes https://github.com/theupdateframework/python-tuf/issues/1639
Follow-up of #1808
- [x] The code follows the Code Style Guidelines
- [x] Tests have been added for the bug fix or new feature
- [n/a] Docs have been added for the bug fix or new feature
Pull Request Test Coverage Report for Build 2027942163
- 0 of 0 changed or added relevant lines in 0 files are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage remained the same at 98.312%
| Totals | |
|---|---|
| Change from base Build 2022257279: | 0.0% |
| Covered Lines: | 1179 |
| Relevant Lines: | 1195 |
💛 - Coveralls
I've not given this the review it needed, sorry... This vaguely looks like we could do better but I can't immediately see the better way: did you consider having the same test setup as in the existing downloads test test_targetfile_search() -- so there would be
- staticly defined metadata structure: it could be the same delegations_tree already defined in the file, just added with a targets metadata that does hashed bin delegations
- test cases would then only have to define a target path to search for, search result and the expected visited order
This would not make the current test much shorter but it might mean that adding a new test case would be maybe 2 lines instead of 40 lines of test data that it is now?
Is this superseded by #2031? Should we think about deprecating path_hash_prefixes now that TAP 15 has landed? (see see https://github.com/theupdateframework/taps/issues/132#issuecomment-1115175226)
Is this superseded by #2031?
I think so. I wouldn't object to a tight client test specifically for hashed bins but I don't think it's super important, and this PR is 80 lines of test code for very limited (new) test functionality.