Expand description
Download test assets, managing them outside of git
This library downloads test assets using http(s), and ensures integrity by comparing those assets to a hash. By managing the download separately, you can keep them out of VCS and don’t make them bloat your repository.
Usage example:
#[test]
fn some_awesome_test() {
let asset_defs = [
TestAssetDef {
filename : format!("file_a.png"),
hash : format!("<sha256 here>"),
url : format!("https://url/to/a.png"),
},
TestAssetDef {
filename : format!("file_b.png"),
hash : format!("<sha256 here>"),
url : format!("https://url/to/a.png"),
},
];
test_assets::dl_test_files(&asset_defs,
"test-assets", true).unwrap();
// use your files here
// with path under test-assets/file_a.png and test-assets/file_b.png
}
If you have run the test once, it will re-use the files instead of re-downloading them.
Structs§
- Sha256
Hash - A type for a Sha256 hash value
- Test
Asset Def - Definition for a test file
Enums§
Functions§
- dl_
test_ files - Downloads the test files into the passed directory.
- dl_
test_ files_ backoff - Download test-assets with backoff retries