[][src]Function dishub::ops::unfollow_feeds::verify

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

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

The return value contains either the path to the path to the file containing the global feeds or why getting it failed.

Examples

Verifying an existing feeds file.

let tf = temp_dir().join("dishub-doctest").join("ops-unfollow_feeds-verify-0");
fs::create_dir_all(&tf).unwrap();
File::create(tf.join("feeds.toml")).unwrap().write(&[]).unwrap();

assert_eq!(unfollow_feeds::verify(&("$TEMP/ops-unfollow_feeds-verify-0".to_string(), tf.clone())),
           Ok(tf.join("feeds.toml")));
assert!(tf.join("feeds.toml").exists());

Verifying a nonexistant feeds file.

let tf = temp_dir().join("dishub-doctest").join("ops-unfollow_feeds-verify-1");
assert_eq!(unfollow_feeds::verify(&("$TEMP/ops-unfollow_feeds-verify-1".to_string(), tf)),
           Err(Error::RequiredFileFromSubsystemNonexistant {
                   subsys: "add-feeds",
                   fname: "$TEMP/ops-unfollow_feeds-verify-1/feeds.toml".to_string(),
               }));