1 unstable release
0.3.0 | Nov 9, 2024 |
---|
#448 in Cryptography
1,443 downloads per month
Used in 2 crates
11KB
213 lines
Test Assets
Download test assets, managing them outside of git.
Changes from being a fork of test-assets:
- Use rust library
ureq
and avoid compiling curl for test binaries - Includes backoff support
Compiler support: requires rustc 1.70.0+
lib.rs
:
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.
Dependencies
~3–4.5MB
~80K SLoC