feat: push deletion

This commit is contained in:
grimhilt
2024-05-02 18:36:09 +02:00
parent 4504b98112
commit 939b6f2fe3
7 changed files with 70 additions and 17 deletions

View File

@@ -104,6 +104,14 @@ impl ClientTest {
Ok(())
}
pub fn remove_dir(&mut self, name: &str) -> std::io::Result<()> {
let mut path = self.volume.clone();
path.push_str("/");
path.push_str(name);
fs::remove_dir_all(path)?;
Ok(())
}
pub fn has_file(&mut self, file: &str, content: &str) -> bool {
let full_path = PathBuf::from(self.volume.clone()).join(file);

View File

@@ -36,3 +36,15 @@ pub fn has_not_file(full_path: PathBuf, file: &str, test_id: String) -> bool
return true;
}
#[cfg(test)]
pub fn has_not_dir(full_path: PathBuf, dir: &str, test_id: String) -> bool
{
if full_path.exists() {
println!("id: {}", test_id.clone());
eprintln!("Dir '{}' exists but it shouldn't", dir);
return false;
}
return true;
}

View File

@@ -113,5 +113,11 @@ impl ServerTest {
let full_path = self.volume.clone().join(file);
files_utils::has_not_file(full_path, file, self.test_id.clone())
}
pub fn has_not_dir(&mut self, dir: &str) -> bool {
let full_path = self.volume.clone().join(dir);
dbg!(full_path.clone());
files_utils::has_not_file(full_path, dir, self.test_id.clone())
}
}