[][src]Module bindle::testing

Some helpful utilities for testing. This module is only available if the test-tools feature is enabled. Its main feature is allowing the use of prebuilt scaffolds for testing.

See the README in the testing directory of bindle for more information on scaffolding structure. All loading functions will load scaffolds by default from $CARGO_MANIFEST_DIR/tests/scaffolds. However, this directory can be configured by setting the BINDLE_SCAFFOLD_DIR environment variable to your desired path. All functions will panic if they encounter an error to make it easier on users (so they don't have to handle the errors in their tests in the exact same way)

Structs

RawScaffold

A scaffold loaded from disk, containing the raw bytes for all files in the bindle. Both label_files and parcel_files are the names of the files on disk with the extension removed. This allows for easy lookups in both maps as they should have the same name

Scaffold

A scaffold loaded from disk, containing the bindle object representations for all files in the bindle (except for the parcels themselves, as they can be binary data). Both labels and parcel_files` are the names of the files on disk with the extension removed. This allows for easy lookups in both maps as they should have the same name

Constants

SCAFFOLD_DIR_ENV

The environment variable name used for setting the scaffolds directory

Functions

load_all_files

Loads all scaffolds in the scaffolds directory, returning them as a hashmap with the directory name as the key and a RawScaffold as a value. There is not an equivalent for loading all scaffolds as a Scaffold object, because some of them may be invalid on will not deserialize properly

setup

Returns a file Store implementation configured with a temporary directory and strict Search implementation for use in testing API endpoints