diff options
Diffstat (limited to 'tests/db.rs')
-rw-r--r-- | tests/db.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/db.rs b/tests/db.rs index 16061d0..7127fc6 100644 --- a/tests/db.rs +++ b/tests/db.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use std::{fs::{File, create_dir_all}, path::Path, sync::Once}; | 1 | use std::{fs::{File, create_dir_all, remove_dir_all}, path::Path, sync::Once}; |
2 | 2 | ||
3 | use modlist::{config::{Cfg, Apis}, db::{mods_insert, db_setup, mods_get_all_ids, mods_get_id, mods_remove, userlist_insert, lists_insert, userlist_get_all_ids, userlist_remove, mods_get_versions, userlist_get_applicable_versions, lists_remove, lists_get, lists_get_all_ids, userlist_get_all_current_version_ids, userlist_change_versions, s_userlist_update_download, userlist_get_all_downloads, config_change_current_list, config_get_current_list, s_config_update_version, s_config_create_version, s_config_get_version}, Modloader, List}; | 3 | use modlist::{config::{Cfg, Apis}, db::{mods_insert, db_setup, mods_get_all_ids, mods_get_id, mods_remove, userlist_insert, lists_insert, userlist_get_all_ids, userlist_remove, mods_get_versions, userlist_get_applicable_versions, lists_remove, lists_get, lists_get_all_ids, userlist_get_all_current_version_ids, userlist_change_versions, s_userlist_update_download, userlist_get_all_downloads, config_change_current_list, config_get_current_list, s_config_update_version, s_config_create_version, s_config_get_version}, Modloader, List}; |
4 | 4 | ||
@@ -11,6 +11,7 @@ fn setup() -> Cfg { | |||
11 | 11 | ||
12 | INIT.call_once(|| { | 12 | INIT.call_once(|| { |
13 | let db_path = Path::new(db_pathstr); | 13 | let db_path = Path::new(db_pathstr); |
14 | if db_path.exists() { remove_dir_all(db_pathstr).unwrap(); }; | ||
14 | create_dir_all(db_path).unwrap(); | 15 | create_dir_all(db_path).unwrap(); |
15 | let db_filestr = format!("{}/data.db", db_pathstr); | 16 | let db_filestr = format!("{}/data.db", db_pathstr); |
16 | File::create(db_filestr).unwrap(); | 17 | File::create(db_filestr).unwrap(); |
@@ -46,7 +47,7 @@ fn test_mods_get_all_ids() { | |||
46 | fn test_mods_get_id() { | 47 | fn test_mods_get_id() { |
47 | let config = setup(); | 48 | let config = setup(); |
48 | 49 | ||
49 | mods_insert(config.clone(), String::from("GI"), String::from("GETID_TEST"), vec![String::from("GI_VER1"), String::from("GI_VER2")]).unwrap(); | 50 | mods_insert(config, String::from("GI"), String::from("GETID_TEST"), vec![String::from("GI_VER1"), String::from("GI_VER2")]).unwrap(); |
50 | } | 51 | } |
51 | 52 | ||
52 | #[test] | 53 | #[test] |