[][src]Function tweetr::ops::add_user::verify

pub fn verify(
    config_dir: &(String, PathBuf)
) -> Result<(PathBuf, PathBuf), Outcome>

Verify if, given the current configuration, it's permitted to continue with the subsequent steps of the add-user subsystem.

The return value contains either the path to the file containing the global app configuration and the path to the file containing the global users data or why getting them failed.

Examples

Verifying with existing global app configuration.

let tf = temp_dir().join("tweetr-doctest").join("ops-add-user-verify-0");
fs::create_dir_all(&tf).unwrap();
File::create(tf.join("app.toml")).unwrap().write(&[]).unwrap();

assert_eq!(add_user::verify(&("$TEMP/ops-add-user-verify-0".to_string(), tf.clone())),
           Ok((tf.join("app.toml"), tf.join("users.toml"))));

Verifying when the global app configuration doesn't exist.

let tf = temp_dir().join("tweetr-doctest").join("ops-add-user-verify-1");
assert_eq!(add_user::verify(&("$TEMP/ops-add-user-verify-1".to_string(), tf)),
           Err(Outcome::RequiredFileFromSubsystemNonexistant {
               subsys: "init",
               fname: "$TEMP/ops-add-user-verify-1/app.toml".to_string(),
           }));