diff options
author | fxqnlr <[email protected]> | 2022-11-07 22:29:35 +0100 |
---|---|---|
committer | fxqnlr <[email protected]> | 2022-11-07 22:29:35 +0100 |
commit | 889dc4f87b05d838b25428478a8c42dac454a5cf (patch) | |
tree | c4b09ae53a74a7f0afc1e095a4b66a1b00e67244 /tests | |
parent | ea50af892c4268ae06f6df40ee435eadd076228d (diff) | |
download | modlist-889dc4f87b05d838b25428478a8c42dac454a5cf.tar modlist-889dc4f87b05d838b25428478a8c42dac454a5cf.tar.gz modlist-889dc4f87b05d838b25428478a8c42dac454a5cf.zip |
finished rusqlite; added all db tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/db.rs | 248 | ||||
-rw-r--r-- | tests/db_integration.rs | 115 |
2 files changed, 248 insertions, 115 deletions
diff --git a/tests/db.rs b/tests/db.rs new file mode 100644 index 0000000..16061d0 --- /dev/null +++ b/tests/db.rs | |||
@@ -0,0 +1,248 @@ | |||
1 | use std::{fs::{File, create_dir_all}, path::Path, sync::Once}; | ||
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}; | ||
4 | |||
5 | static INIT: Once = Once::new(); | ||
6 | |||
7 | fn setup() -> Cfg { | ||
8 | let db_pathstr = "./test_tmp/db"; | ||
9 | |||
10 | let config = Cfg { data: String::from(db_pathstr), downloads: String::from("-"), clean_remove: false, apis: Apis { modrinth: String::from("-") } }; | ||
11 | |||
12 | INIT.call_once(|| { | ||
13 | let db_path = Path::new(db_pathstr); | ||
14 | create_dir_all(db_path).unwrap(); | ||
15 | let db_filestr = format!("{}/data.db", db_pathstr); | ||
16 | File::create(db_filestr).unwrap(); | ||
17 | println!("INIT TEST DB"); | ||
18 | db_setup(config.clone()).unwrap(); | ||
19 | }); | ||
20 | config | ||
21 | } | ||
22 | |||
23 | #[test] | ||
24 | fn test_mods_insert() { | ||
25 | let config = setup(); | ||
26 | |||
27 | mods_insert(config.clone(), String::from("I"), String::from("INSERT_TEST"), vec![String::from("INSERT_VER1"), String::from("INSERT_VER2")]).unwrap(); | ||
28 | let ids = mods_get_all_ids(config).unwrap(); | ||
29 | |||
30 | assert!(ids.contains(&String::from("I"))); | ||
31 | } | ||
32 | |||
33 | #[test] | ||
34 | fn test_mods_get_all_ids() { | ||
35 | let config = setup(); | ||
36 | |||
37 | mods_insert(config.clone(), String::from("GAI1"), String::from("GETALLIDS_TEST1"), vec![String::from("GAI1_VER1"), String::from("GAI1_VER2")]).unwrap(); | ||
38 | mods_insert(config.clone(), String::from("GAI2"), String::from("GETALLIDS_TEST2"), vec![String::from("GAI2_VER1"), String::from("GAI2_VER2")]).unwrap(); | ||
39 | let ids = mods_get_all_ids(config).unwrap(); | ||
40 | |||
41 | assert!(ids.contains(&String::from("GAI1"))); | ||
42 | assert!(ids.contains(&String::from("GAI2"))); | ||
43 | } | ||
44 | |||
45 | #[test] | ||
46 | fn test_mods_get_id() { | ||
47 | let config = setup(); | ||
48 | |||
49 | mods_insert(config.clone(), String::from("GI"), String::from("GETID_TEST"), vec![String::from("GI_VER1"), String::from("GI_VER2")]).unwrap(); | ||
50 | } | ||
51 | |||
52 | #[test] | ||
53 | fn test_mods_remove() { | ||
54 | let config = setup(); | ||
55 | |||
56 | mods_insert(config.clone(), String::from("R"), String::from("REMOVE_TEST"), vec![String::from("R_VER1"), String::from("R_VER2")]).unwrap(); | ||
57 | let ids = mods_get_all_ids(config.clone()).unwrap(); | ||
58 | assert!(ids.contains(&String::from("R"))); | ||
59 | mods_remove(config.clone(), String::from("R")).unwrap(); | ||
60 | assert!(mods_get_id(config, String::from("REMOVE_TEST")).is_err()); | ||
61 | } | ||
62 | |||
63 | #[test] | ||
64 | fn test_mods_get_versions() { | ||
65 | let config = setup(); | ||
66 | |||
67 | mods_insert(config.clone(), String::from("M_GVs1"), String::from("M_GVs_TEST1"), vec![String::from("M_GVs1_VER1"), String::from("M_GVs1_VER2")]).unwrap(); | ||
68 | mods_insert(config.clone(), String::from("M_GVs2"), String::from("M_GVs_TEST2"), vec![String::from("M_GVs2_VER1"), String::from("M_GVs2_VER2")]).unwrap(); | ||
69 | let versions = mods_get_versions(config, vec![String::from("M_GVs1"), String::from("M_GVs2")]).unwrap(); | ||
70 | |||
71 | assert!(versions.contains(&modlist::db::DBModlistVersions { mod_id: String::from("M_GVs1"), versions: String::from("M_GVs1_VER1|M_GVs1_VER2") })); | ||
72 | assert!(versions.contains(&modlist::db::DBModlistVersions { mod_id: String::from("M_GVs2"), versions: String::from("M_GVs2_VER1|M_GVs2_VER2") })); | ||
73 | } | ||
74 | |||
75 | //user_list | ||
76 | #[test] | ||
77 | fn test_userlist_insert() { | ||
78 | let config = setup(); | ||
79 | |||
80 | lists_insert(config.clone(), String::from("UL_I_LIST"), String::from("UL_I_MC"), Modloader::Fabric).unwrap(); | ||
81 | userlist_insert(config, String::from("UL_I_LIST"), String::from("UL_I"), String::from("UL_I_VER1"), vec![String::from("UL_I_VER1"), String::from("UL_I_VER2")], String::from("localhost:8080/dl/UL_I_VER1.test")).unwrap(); | ||
82 | } | ||
83 | |||
84 | #[test] | ||
85 | fn test_userlist_get_all_ids() { | ||
86 | let config = setup(); | ||
87 | |||
88 | lists_insert(config.clone(), String::from("UL_GAI_LIST"), String::from("UL_GAI_MC"), Modloader::Fabric).unwrap(); | ||
89 | userlist_insert(config.clone(), String::from("UL_GAI_LIST"), String::from("UL_GAI1"), String::from("UL_GAI1_VER1"), vec![String::from("UL_GAI2_VER1"), String::from("UL_GAI1_VER2")], String::from("localhost:8080/dl/UL_GAI1_VER1.test")).unwrap(); | ||
90 | userlist_insert(config.clone(), String::from("UL_GAI_LIST"), String::from("UL_GAI2"), String::from("UL_GAI2_VER1"), vec![String::from("UL_GAI2_VER1"), String::from("UL_GAI2_VER2")], String::from("localhost:8080/dl/UL_GAI2_VER1.test")).unwrap(); | ||
91 | let ids = userlist_get_all_ids(config, String::from("UL_GAI_LIST")).unwrap(); | ||
92 | |||
93 | assert!(ids.contains(&String::from("UL_GAI1"))); | ||
94 | assert!(ids.contains(&String::from("UL_GAI2"))); | ||
95 | } | ||
96 | |||
97 | #[test] | ||
98 | fn test_userlist_remove() { | ||
99 | let config = setup(); | ||
100 | |||
101 | lists_insert(config.clone(), String::from("UL_R_LIST"), String::from("UL_R_MC"), Modloader::Fabric).unwrap(); | ||
102 | userlist_insert(config.clone(), String::from("UL_R_LIST"), String::from("UL_R"), String::from("UL_R_VER1"), vec![String::from("UL_R_VER1"), String::from("UL_R_VER2")], String::from("localhost:8080/dl/UL_R_VER1.test")).unwrap(); | ||
103 | let ids = userlist_get_all_ids(config.clone(), String::from("UL_R_LIST")).unwrap(); | ||
104 | assert!(ids.contains(&String::from("UL_R"))); | ||
105 | userlist_remove(config.clone(), String::from("UL_R_LIST"), String::from("UL_R")).unwrap(); | ||
106 | assert!(userlist_get_all_ids(config, String::from("UL_R_LIST")).is_err()) | ||
107 | } | ||
108 | |||
109 | #[test] | ||
110 | fn test_userlist_get_applicable_versions() { | ||
111 | let config = setup(); | ||
112 | |||
113 | lists_insert(config.clone(), String::from("UL_GAV_LIST"), String::from("UL_GAV_MC"), Modloader::Fabric).unwrap(); | ||
114 | userlist_insert(config.clone(), String::from("UL_GAV_LIST"), String::from("UL_GAV"), String::from("UL_GAV_VER1"), vec![String::from("UL_GAV_VER1"), String::from("UL_GAV_VER2")], String::from("localhost:8080/dl/UL_GAV_VER1.test")).unwrap(); | ||
115 | assert_eq!(userlist_get_applicable_versions(config, String::from("UL_GAV_LIST"), String::from("UL_GAV")).unwrap(), String::from("UL_GAV_VER1|UL_GAV_VER2")); | ||
116 | } | ||
117 | |||
118 | #[test] | ||
119 | fn test_userlist_get_all_current_version_ids() { | ||
120 | let config = setup(); | ||
121 | |||
122 | lists_insert(config.clone(), String::from("UL_GACVI_LIST"), String::from("UL_GACVI_MC"), Modloader::Fabric).unwrap(); | ||
123 | userlist_insert(config.clone(), String::from("UL_GACVI_LIST"), String::from("UL_GACVI1"), String::from("UL_GACVI1_VER1"), vec![String::from("UL_GACVI2_VER1"), String::from("UL_GACVI1_VER2")], String::from("localhost:8080/dl/UL_GACVI1_VER1.test")).unwrap(); | ||
124 | userlist_insert(config.clone(), String::from("UL_GACVI_LIST"), String::from("UL_GACVI2"), String::from("UL_GACVI2_VER1"), vec![String::from("UL_GACVI2_VER1"), String::from("UL_GACVI2_VER2")], String::from("localhost:8080/dl/UL_GACVI2_VER1.test")).unwrap(); | ||
125 | |||
126 | let ids = userlist_get_all_current_version_ids(config, String::from("UL_GACVI_LIST")).unwrap(); | ||
127 | |||
128 | assert!(ids.contains(&String::from("UL_GACVI1_VER1"))); | ||
129 | assert!(ids.contains(&String::from("UL_GACVI2_VER1"))); | ||
130 | } | ||
131 | |||
132 | #[test] | ||
133 | fn test_userlist_change_versions() { | ||
134 | let config = setup(); | ||
135 | |||
136 | lists_insert(config.clone(), String::from("UL_CV_LIST"), String::from("UL_CV_MC"), Modloader::Fabric).unwrap(); | ||
137 | userlist_insert(config.clone(), String::from("UL_CV_LIST"), String::from("UL_CV"), String::from("UL_CV_VER1"), vec![String::from("UL_CV_VER1"), String::from("UL_CV_VER2")], String::from("localhost:8080/dl/UL_CV_VER1.test")).unwrap(); | ||
138 | let versions = userlist_get_all_current_version_ids(config.clone(), String::from("UL_CV_LIST")).unwrap(); | ||
139 | assert!(versions.contains(&String::from("UL_CV_VER1"))); | ||
140 | |||
141 | userlist_change_versions(config.clone(), String::from("UL_CV_LIST"), String::from("UL_CV_VER3"), String::from("UL_CV_VER1|UL_CV_VER2|UL_CV_VER3"), String::from("localhost:8080/dl/UL_CV_VER3.test"), String::from("UL_CV")).unwrap(); | ||
142 | let versions = userlist_get_all_current_version_ids(config, String::from("UL_CV_LIST")).unwrap(); | ||
143 | assert!(!versions.contains(&String::from("UL_CV_VER1"))); | ||
144 | assert!(versions.contains(&String::from("UL_CV_VER3"))); | ||
145 | } | ||
146 | |||
147 | #[test] | ||
148 | fn test_userlist_get_all_downloads() { | ||
149 | let config = setup(); | ||
150 | |||
151 | lists_insert(config.clone(), String::from("UL_GAD_LIST"), String::from("UL_GAD_MC"), Modloader::Fabric).unwrap(); | ||
152 | userlist_insert(config.clone(), String::from("UL_GAD_LIST"), String::from("UL_GAD1"), String::from("UL_GAD1_VER1"), vec![String::from("UL_GAD1_VER1"), String::from("UL_GAD1_VER1")], String::from("localhost:8080/dl/UL_GAD1_VER1.test")).unwrap(); | ||
153 | userlist_insert(config.clone(), String::from("UL_GAD_LIST"), String::from("UL_GAD2"), String::from("UL_GAD2_VER1"), vec![String::from("UL_GAD2_VER1"), String::from("UL_GAD2_VER1")], String::from("localhost:8080/dl/UL_GAD2_VER1.test")).unwrap(); | ||
154 | let links = userlist_get_all_downloads(config, String::from("UL_GAD_LIST")).unwrap(); | ||
155 | |||
156 | assert!(links.contains(&String::from("localhost:8080/dl/UL_GAD1_VER1.test"))); | ||
157 | assert!(links.contains(&String::from("localhost:8080/dl/UL_GAD2_VER1.test"))); | ||
158 | } | ||
159 | |||
160 | |||
161 | //lists | ||
162 | #[test] | ||
163 | fn test_lists_insert() { | ||
164 | let config = setup(); | ||
165 | |||
166 | lists_insert(config, String::from("L_I_LIST"), String::from("L_I_MC"), Modloader::Fabric).unwrap(); | ||
167 | } | ||
168 | |||
169 | #[test] | ||
170 | fn test_lists_remove() { | ||
171 | let config = setup(); | ||
172 | |||
173 | lists_insert(config.clone(), String::from("L_R_LIST"), String::from("L_R_MC"), Modloader::Fabric).unwrap(); | ||
174 | lists_remove(config, String::from("L_R_LIST")).unwrap(); | ||
175 | } | ||
176 | |||
177 | #[test] | ||
178 | fn test_lists_get() { | ||
179 | let config = setup(); | ||
180 | |||
181 | lists_insert(config.clone(), String::from("L_G_LIST"), String::from("L_G_MC"), Modloader::Fabric).unwrap(); | ||
182 | |||
183 | assert_eq!(lists_get(config, String::from("L_G_LIST")).unwrap(), List { id: String::from("L_G_LIST"), mc_version: String::from("L_G_MC"), modloader: Modloader::Fabric }); | ||
184 | } | ||
185 | |||
186 | #[test] | ||
187 | fn test_lists_get_all_ids() { | ||
188 | let config = setup(); | ||
189 | |||
190 | lists_insert(config.clone(), String::from("L_GAI1_LIST"), String::from("L_GAI1_MC"), Modloader::Fabric).unwrap(); | ||
191 | lists_insert(config.clone(), String::from("L_GAI2_LIST"), String::from("L_GAI2_MC"), Modloader::Fabric).unwrap(); | ||
192 | let ids = lists_get_all_ids(config).unwrap(); | ||
193 | |||
194 | assert!(ids.contains(&String::from("L_GAI1_LIST"))); | ||
195 | assert!(ids.contains(&String::from("L_GAI2_LIST"))); | ||
196 | } | ||
197 | |||
198 | //config | ||
199 | #[test] | ||
200 | fn test_config_change_current_list() { | ||
201 | let config = setup(); | ||
202 | |||
203 | config_change_current_list(config, String::from("C_CCL_LIST")).unwrap(); | ||
204 | } | ||
205 | |||
206 | #[test] | ||
207 | fn test_config_get_current_list() { | ||
208 | let config = setup(); | ||
209 | |||
210 | config_change_current_list(config.clone(), String::from("C_GCL_LIST")).unwrap(); | ||
211 | assert_eq!(config_get_current_list(config).unwrap(), String::from("C_GCL_LIST")); | ||
212 | } | ||
213 | |||
214 | //setup | ||
215 | #[test] | ||
216 | fn test_s_userlist_update_download() { | ||
217 | let config = setup(); | ||
218 | |||
219 | lists_insert(config.clone(), String::from("UL_UD_LIST"), String::from("UL_UD_MC"), Modloader::Fabric).unwrap(); | ||
220 | userlist_insert(config.clone(), String::from("UL_UD_LIST"), String::from("UL_UD"), String::from("UL_UD_VER1"), vec![String::from("UL_UD_VER1"), String::from("UL_UD_VER1")], String::from("localhost:8080/dl/UL_UD_VER1.test")).unwrap(); | ||
221 | s_userlist_update_download(config.clone(), String::from("UL_UD_LIST"), String::from("UL_UD"), String::from("localhost:8080/dl/UL_UD_VER1X.test")).unwrap(); | ||
222 | let links = userlist_get_all_downloads(config, String::from("UL_UD_LIST")).unwrap(); | ||
223 | |||
224 | assert!(links.contains(&String::from("localhost:8080/dl/UL_UD_VER1X.test"))); | ||
225 | assert!(!links.contains(&String::from("localhost:8080/dl/UL_UD_VER1.test"))); | ||
226 | } | ||
227 | |||
228 | #[test] | ||
229 | fn test_s_config_create_version() { | ||
230 | let config = setup(); | ||
231 | |||
232 | s_config_create_version(config).unwrap(); | ||
233 | } | ||
234 | |||
235 | #[test] | ||
236 | fn test_s_config_update_version() { | ||
237 | let config = setup(); | ||
238 | |||
239 | s_config_update_version(config, String::from("S_C_UV")).unwrap(); | ||
240 | } | ||
241 | |||
242 | #[test] | ||
243 | fn test_s_config_get_version() { | ||
244 | let config = setup(); | ||
245 | |||
246 | s_config_update_version(config.clone(), String::from("S_C_GV")).unwrap(); | ||
247 | assert_eq!(s_config_get_version(config).unwrap(), String::from("S_C_GV")); | ||
248 | } | ||
diff --git a/tests/db_integration.rs b/tests/db_integration.rs deleted file mode 100644 index 8c3d194..0000000 --- a/tests/db_integration.rs +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
1 | use std::{fs::{File, create_dir_all}, path::Path, sync::Once}; | ||
2 | |||
3 | use modlist::{config::{Cfg, Apis}, db::{mods_insert, db_setup, user_dbversion, mods_get_all_ids, mods_get_id, mods_remove, userlist_insert, lists_insert, userlist_get_all_ids, userlist_remove}, Modloader}; | ||
4 | |||
5 | static INIT: Once = Once::new(); | ||
6 | |||
7 | fn setup() -> Cfg { | ||
8 | let db_pathstr = "./test_tmp/db"; | ||
9 | |||
10 | let config = Cfg { data: String::from(db_pathstr), downloads: String::from("-"), clean_remove: false, apis: Apis { modrinth: String::from("-") } }; | ||
11 | |||
12 | INIT.call_once(|| { | ||
13 | let db_path = Path::new(db_pathstr); | ||
14 | create_dir_all(db_path).unwrap(); | ||
15 | let db_filestr = format!("{}/data.db", db_pathstr); | ||
16 | File::create(db_filestr).unwrap(); | ||
17 | println!("INIT TEST DB"); | ||
18 | db_setup(config.clone()).unwrap(); | ||
19 | }); | ||
20 | config | ||
21 | } | ||
22 | |||
23 | #[test] | ||
24 | fn test_user_dbversion() { | ||
25 | let config = setup(); | ||
26 | |||
27 | assert_eq!(user_dbversion(config).unwrap(), "0.2"); | ||
28 | } | ||
29 | |||
30 | #[test] | ||
31 | fn test_mods_insert() { | ||
32 | let config = setup(); | ||
33 | |||
34 | mods_insert(config.clone(), String::from("I"), String::from("INSERT_TEST"), vec![String::from("INSERT_VER1"), String::from("INSERT_VER2")]).unwrap(); | ||
35 | let ids = mods_get_all_ids(config).unwrap(); | ||
36 | |||
37 | assert!(ids.contains(&String::from("I"))); | ||
38 | } | ||
39 | |||
40 | #[test] | ||
41 | fn test_mods_get_all_ids() { | ||
42 | let config = setup(); | ||
43 | |||
44 | mods_insert(config.clone(), String::from("GAI1"), String::from("GETALLIDS_TEST1"), vec![String::from("GAI1_VER1"), String::from("GAI1_VER2")]).unwrap(); | ||
45 | mods_insert(config.clone(), String::from("GAI2"), String::from("GETALLIDS_TEST2"), vec![String::from("GAI2_VER1"), String::from("GAI2_VER2")]).unwrap(); | ||
46 | let ids = mods_get_all_ids(config).unwrap(); | ||
47 | |||
48 | assert!(ids.contains(&String::from("GAI1"))); | ||
49 | assert!(ids.contains(&String::from("GAI2"))); | ||
50 | } | ||
51 | |||
52 | #[test] | ||
53 | fn test_mods_get_id() { | ||
54 | let config = setup(); | ||
55 | |||
56 | mods_insert(config.clone(), String::from("GI"), String::from("GETID_TEST"), vec![String::from("GI_VER1"), String::from("GI_VER2")]).unwrap(); | ||
57 | let id = mods_get_id(config, String::from("GETID_TEST")).unwrap(); | ||
58 | |||
59 | assert_eq!(id, String::from("GI")); | ||
60 | } | ||
61 | |||
62 | #[test] | ||
63 | fn test_mods_remove() { | ||
64 | let config = setup(); | ||
65 | |||
66 | mods_insert(config.clone(), String::from("R"), String::from("REMOVE_TEST"), vec![String::from("R_VER1"), String::from("R_VER2")]).unwrap(); | ||
67 | let ids = mods_get_all_ids(config.clone()).unwrap(); | ||
68 | assert!(ids.contains(&String::from("R"))); | ||
69 | mods_remove(config.clone(), String::from("R")).unwrap(); | ||
70 | assert!(mods_get_id(config, String::from("REMOVE_TEST")).is_err()); | ||
71 | } | ||
72 | |||
73 | //user_list | ||
74 | #[test] | ||
75 | fn test_userlist_insert() { | ||
76 | let config = setup(); | ||
77 | |||
78 | lists_insert(config.clone(), String::from("UL_I_LIST"), String::from("UL_I_MC"), Modloader::Fabric).unwrap(); | ||
79 | userlist_insert(config, String::from("UL_I_LIST"), String::from("UL_I"), String::from("UL_I_VER1"), vec![String::from("UL_I_VER1"), String::from("UL_I_VER2")], String::from("localhost:8080/dl/UL_I_VER1.test")).unwrap(); | ||
80 | //let list = mods_get_all_ids(config).unwrap(); | ||
81 | |||
82 | //assert!(ids.contains(&String::from("I"))); | ||
83 | } | ||
84 | |||
85 | #[test] | ||
86 | fn test_userlist_get_all_ids() { | ||
87 | let config = setup(); | ||
88 | |||
89 | lists_insert(config.clone(), String::from("UL_GAI_LIST"), String::from("UL_GAI_MC"), Modloader::Fabric).unwrap(); | ||
90 | userlist_insert(config.clone(), String::from("UL_GAI_LIST"), String::from("UL_GAI1"), String::from("UL_GAI1_VER1"), vec![String::from("UL_GAI2_VER1"), String::from("UL_GAI1_VER2")], String::from("localhost:8080/dl/UL_GAI1_VER1.test")).unwrap(); | ||
91 | userlist_insert(config.clone(), String::from("UL_GAI_LIST"), String::from("UL_GAI2"), String::from("UL_GAI2_VER1"), vec![String::from("UL_GAI2_VER1"), String::from("UL_GAI2_VER2")], String::from("localhost:8080/dl/UL_GAI2_VER1.test")).unwrap(); | ||
92 | let ids = userlist_get_all_ids(config, String::from("UL_GAI_LIST")).unwrap(); | ||
93 | |||
94 | assert!(ids.contains(&String::from("UL_GAI1"))); | ||
95 | assert!(ids.contains(&String::from("UL_GAI2"))); | ||
96 | } | ||
97 | |||
98 | #[test] | ||
99 | fn test_userlist_remove() { | ||
100 | let config = setup(); | ||
101 | |||
102 | lists_insert(config.clone(), String::from("UL_R_LIST"), String::from("UL_R_MC"), Modloader::Fabric).unwrap(); | ||
103 | userlist_insert(config.clone(), String::from("UL_R_LIST"), String::from("UL_R"), String::from("UL_R_VER1"), vec![String::from("UL_R_VER1"), String::from("UL_R_VER2")], String::from("localhost:8080/dl/UL_R_VER1.test")).unwrap(); | ||
104 | let ids = userlist_get_all_ids(config.clone(), String::from("UL_R_LIST")).unwrap(); | ||
105 | assert!(ids.contains(&String::from("UL_R"))); | ||
106 | userlist_remove(config.clone(), String::from("UL_R_LIST"), String::from("UL_R")).unwrap(); | ||
107 | assert!(userlist_get_all_ids(config, String::from("UL_R_LIST")).is_err()) | ||
108 | } | ||
109 | //lists | ||
110 | #[test] | ||
111 | fn test_lists_insert() { | ||
112 | let config = setup(); | ||
113 | |||
114 | lists_insert(config, String::from("TESTLIST"), String::from("L_I_LIST"), Modloader::Fabric).unwrap(); | ||
115 | } | ||