test: fix context ensure_available test
This commit is contained in:
@@ -32,8 +32,13 @@ mod tests {
|
|||||||
let ctx = Context::new(ContextConfig::Local);
|
let ctx = Context::new(ContextConfig::Local);
|
||||||
let dest = ctx.ensure_available(&src_file, "/tmp").unwrap();
|
let dest = ctx.ensure_available(&src_file, "/tmp").unwrap();
|
||||||
|
|
||||||
// Should return canonical path
|
// Should return a path that exists and has the same content
|
||||||
assert_eq!(dest, src_file.canonicalize().unwrap());
|
assert!(dest.exists());
|
||||||
|
let content = fs::read_to_string(&dest).unwrap();
|
||||||
|
assert_eq!(content, "local");
|
||||||
|
|
||||||
|
// The dest should be in the /tmp directory
|
||||||
|
assert!(dest.starts_with("/tmp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -106,7 +111,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_context_file_ops() {
|
fn test_context_file_ops() {
|
||||||
let temp_dir = tempfile::tempdir().unwrap();
|
let temp_dir = tempfile::tempdir().unwrap();
|
||||||
let ctx = super::manager().current();
|
let ctx = Context::new(ContextConfig::Local);
|
||||||
|
|
||||||
let file_path = temp_dir.path().join("test.txt");
|
let file_path = temp_dir.path().join("test.txt");
|
||||||
let content = "hello world";
|
let content = "hello world";
|
||||||
|
|||||||
Reference in New Issue
Block a user