Added test and moved test files
This commit is contained in:
@@ -3,6 +3,7 @@ mod managers;
|
||||
mod models;
|
||||
mod parsers;
|
||||
mod syncers;
|
||||
mod tests;
|
||||
mod utilities;
|
||||
|
||||
use std::env;
|
||||
|
||||
@@ -207,7 +207,6 @@ mod tests {
|
||||
&& action != "upload-meta")
|
||||
);
|
||||
|
||||
let mut all_flags_found = false;
|
||||
let mut found_count = 0;
|
||||
let mut flags_already_read = Vec::new();
|
||||
|
||||
@@ -228,7 +227,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
all_flags_found = found_count == 3;
|
||||
let all_flags_found = found_count == 3;
|
||||
|
||||
assert_eq!(found_count, 3, "Three flags are required: -u, -p, -h");
|
||||
assert!(all_flags_found, "All flags have not been found");
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
pub mod tests;
|
||||
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
@@ -0,0 +1,59 @@
|
||||
// mod managers;
|
||||
// mod tests;
|
||||
|
||||
// use i
|
||||
// use crate::icarus_dm::managers;
|
||||
// use icarus-dm;
|
||||
// use managers;
|
||||
|
||||
mod tests {
|
||||
|
||||
#[cfg(test)]
|
||||
fn test_song_prep_upload() {
|
||||
use crate::managers;
|
||||
|
||||
let meta_path = String::from("tests/sample2_tracks/album.json");
|
||||
|
||||
if !std::path::Path::new(&meta_path).exists() {
|
||||
assert!(false, "File does not exists: {:?}", meta_path);
|
||||
}
|
||||
|
||||
match icarus_models::album::collection::parse_album(&meta_path) {
|
||||
Ok(album) => {
|
||||
for track in 1..3 {
|
||||
let directory_path = std::path::Path::new(&meta_path);
|
||||
let directory: String = directory_path.parent().unwrap().display().to_string();
|
||||
// let track = 1;
|
||||
let filename: String = if track < 10 {
|
||||
String::from("track0")
|
||||
+ &track.to_string()
|
||||
+ icarus_models::constants::DEFAULTMUSICEXTENSION
|
||||
} else {
|
||||
String::from("track")
|
||||
+ &track.to_string()
|
||||
+ icarus_models::constants::DEFAULTMUSICEXTENSION
|
||||
};
|
||||
let disc = 1;
|
||||
match managers::commit_manager::retrieve_song(
|
||||
&album, track, disc, &directory, &filename,
|
||||
) {
|
||||
Ok(song) => match song.to_data() {
|
||||
Ok(_) => {
|
||||
print!("Success");
|
||||
}
|
||||
Err(err) => {
|
||||
assert!(false, "Error: {:?}", err.to_string());
|
||||
}
|
||||
},
|
||||
Err(err) => {
|
||||
assert!(false, "Error: {:?}", err.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
assert!(false, "Error: {:?}", err.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user