refactor(blob): use object trait to create blob
This commit is contained in:
@@ -23,8 +23,6 @@ impl ClientTest {
|
||||
let mut exe_path = env::current_dir().unwrap();
|
||||
exe_path = exe_path.join("target/debug/nextsync");
|
||||
|
||||
// let _ = env::set_current_dir(vol.clone());
|
||||
|
||||
// build the client
|
||||
ClientTest {
|
||||
user: String::from("admin"),
|
||||
@@ -50,13 +48,8 @@ impl ClientTest {
|
||||
|
||||
}
|
||||
|
||||
pub fn clean(mut self) -> Self {
|
||||
pub fn clean(self) -> Self {
|
||||
let _ = fs::remove_dir_all(&self.volume);
|
||||
|
||||
// set back the current dir
|
||||
self.exe_path.pop();
|
||||
dbg!(self.exe_path.clone());
|
||||
let _ = env::set_current_dir(self.exe_path.clone());
|
||||
self
|
||||
}
|
||||
|
||||
@@ -80,6 +73,14 @@ impl ClientTest {
|
||||
return output;
|
||||
}
|
||||
|
||||
pub fn add_dir(&mut self, name: &str) -> std::io::Result<()> {
|
||||
let mut path = self.volume.clone();
|
||||
path.push_str("/");
|
||||
path.push_str(name);
|
||||
let _ = fs::create_dir_all(path)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn add_file(&mut self, name: &str, content: &str) -> std::io::Result<()> {
|
||||
let mut path = self.volume.clone();
|
||||
path.push_str("/");
|
||||
|
||||
@@ -93,7 +93,7 @@ impl ServerTest {
|
||||
let full_path = self.volume.clone().join(file);
|
||||
|
||||
if !full_path.exists() {
|
||||
eprintln!("File '{}' does't exists on the server", file);
|
||||
eprintln!("File '{}' doesn't exists on the server", file);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user