Crate test_assets [] [src]

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::download_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

Sha256Hash

A type for a Sha256 hash value

TestAssetDef

Definition for a test file

Enums

TaError

Functions

download_test_files

Downloads the test files into the passed directory.