fix(tests): fix testsuite allow to pass push
This commit is contained in:
@@ -20,6 +20,7 @@ pub fn enumerate_remote(
|
||||
let mut deleted: Vec<PathBuf> = vec![];
|
||||
let mut files: Vec<ObjProps> = vec![];
|
||||
let mut objs_hashmap: HashMap<String, Vec<String>> = HashMap::new();
|
||||
|
||||
objs_hashmap.insert(
|
||||
options.relative_s.clone().unwrap_or(String::new()),
|
||||
Vec::new());
|
||||
@@ -53,7 +54,11 @@ pub fn enumerate_remote(
|
||||
};
|
||||
|
||||
// separate folders and files in response
|
||||
let d = options.depth.clone().unwrap_or("0".to_owned()).parse::<u16>().unwrap();
|
||||
let d = options.depth.clone()
|
||||
.unwrap_or("0".to_owned())
|
||||
.parse::<u16>()
|
||||
.unwrap();
|
||||
|
||||
// first element is not used as it is the fetched folder
|
||||
if let Some(should_skip_fct) = should_skip.clone() {
|
||||
iter_with_skip_fct(
|
||||
@@ -82,6 +87,7 @@ pub fn enumerate_remote(
|
||||
&mut all_folders);
|
||||
}
|
||||
}
|
||||
|
||||
// go through all folders not checked for deletion before
|
||||
// as they were empty
|
||||
if let Some(_) = should_skip.clone() {
|
||||
@@ -90,18 +96,13 @@ pub fn enumerate_remote(
|
||||
objs_hashmap.remove(&key);
|
||||
}
|
||||
}
|
||||
dbg!(deleted);
|
||||
dbg!(objs_hashmap);
|
||||
|
||||
(all_folders, files)
|
||||
}
|
||||
|
||||
fn calc_depth(obj: &ObjProps) -> u16 {
|
||||
calc_depth_string(obj.relative_s.clone().unwrap_or(String::new()))
|
||||
}
|
||||
|
||||
fn calc_depth_string(s: String) -> u16 {
|
||||
s.split("/").count() as u16
|
||||
let path = obj.relative_s.clone().unwrap_or(String::new());
|
||||
path.split("/").count() as u16
|
||||
}
|
||||
|
||||
fn iter_with_skip_fct(
|
||||
@@ -121,7 +122,6 @@ fn iter_with_skip_fct(
|
||||
let current_depth = calc_depth(object);
|
||||
|
||||
if object.is_dir() {
|
||||
|
||||
// add folder to parent folder only if exists
|
||||
let mut r_path = PathBuf::from(object.relative_s.clone().unwrap());
|
||||
r_path.pop();
|
||||
|
||||
Reference in New Issue
Block a user