use super::super::*;
use crate::model::artifacts::ArtifactChecksumRecord;
use crate::tests::support::temp_dir;
use std::fs;
#[test]
fn missing_or_non_sibling_paths_reject_without_publication() {
let root = temp_dir("ic-backup-publication-paths");
let temporary = root.join("staging");
let canonical = root.join("snapshot");
let digest = ArtifactChecksumRecord::from_bytes(b"");
assert!(matches!(
commit_artifact_directory(&temporary, &canonical, digest.hash()),
Err(PersistenceError::ArtifactCommitPathMissing { .. })
));
assert!(matches!(
commit_artifact_directory(&temporary, &temporary, digest.hash()),
Err(PersistenceError::ArtifactCommitPathMismatch { .. })
));
assert!(matches!(
commit_artifact_directory(&temporary, &root.join("other/snapshot"), digest.hash()),
Err(PersistenceError::ArtifactCommitPathMismatch { .. })
));
fs::remove_dir_all(root).expect("remove successful fixture");
}