tests(add): introduce basics tests for add

This commit is contained in:
grimhilt
2024-09-08 17:59:39 +02:00
parent baeef1a33a
commit e66dc8d408
4 changed files with 75 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
use nextsync::config::config::Config;
use std::fs::OpenOptions;
use rand::{distributions::Alphanumeric, Rng};
use std::env;
use std::fs::{self, File};
@@ -125,6 +126,18 @@ impl ClientTest {
Ok(())
}
pub fn add_ignore_rule(&self, rule: &str) {
let mut nsignore_path = self.volume.clone();
nsignore_path.push_str("/.nsignore");
let mut file = OpenOptions::new()
.write(true)
.create(true)
.append(true)
.open(nsignore_path).unwrap();
let _ = writeln!(file, "{rule}").unwrap();
}
// pub fn has_file(&mut self, file: &str, content: &str) -> bool {
// let full_path = PathBuf::from(self.volume.clone()).join(file);