diff options
author | fxqnlr <[email protected]> | 2022-11-20 23:54:20 +0100 |
---|---|---|
committer | fxqnlr <[email protected]> | 2022-11-20 23:54:20 +0100 |
commit | c00673fd0e01d1438798dbb1635a761a76a2b559 (patch) | |
tree | 90c1f564fd7225e7312003c82ca269677cc5778d /tests | |
parent | 477e0ecbb7bb34b581c518bfc2bc7ebc210b4673 (diff) | |
download | modlist-c00673fd0e01d1438798dbb1635a761a76a2b559.tar modlist-c00673fd0e01d1438798dbb1635a761a76a2b559.tar.gz modlist-c00673fd0e01d1438798dbb1635a761a76a2b559.zip |
extracted filedownload to fn;
fixed some tests;
added direct-dl to update
Diffstat (limited to 'tests')
-rw-r--r-- | tests/db.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/db.rs b/tests/db.rs index 7127fc6..e0bdb66 100644 --- a/tests/db.rs +++ b/tests/db.rs | |||
@@ -78,7 +78,7 @@ fn test_mods_get_versions() { | |||
78 | fn test_userlist_insert() { | 78 | fn test_userlist_insert() { |
79 | let config = setup(); | 79 | let config = setup(); |
80 | 80 | ||
81 | lists_insert(config.clone(), String::from("UL_I_LIST"), String::from("UL_I_MC"), Modloader::Fabric).unwrap(); | 81 | lists_insert(config.clone(), String::from("UL_I_LIST"), String::from("UL_I_MC"), Modloader::Fabric, String::from("UL_I_FOLDER")).unwrap(); |
82 | 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 | 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(); |
83 | } | 83 | } |
84 | 84 | ||
@@ -86,7 +86,7 @@ fn test_userlist_insert() { | |||
86 | fn test_userlist_get_all_ids() { | 86 | fn test_userlist_get_all_ids() { |
87 | let config = setup(); | 87 | let config = setup(); |
88 | 88 | ||
89 | lists_insert(config.clone(), String::from("UL_GAI_LIST"), String::from("UL_GAI_MC"), Modloader::Fabric).unwrap(); | 89 | lists_insert(config.clone(), String::from("UL_GAI_LIST"), String::from("UL_GAI_MC"), Modloader::Fabric, String::from("UL_GAI_FOLDER")).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(); | 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(); | 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(); | 92 | let ids = userlist_get_all_ids(config, String::from("UL_GAI_LIST")).unwrap(); |
@@ -99,7 +99,7 @@ fn test_userlist_get_all_ids() { | |||
99 | fn test_userlist_remove() { | 99 | fn test_userlist_remove() { |
100 | let config = setup(); | 100 | let config = setup(); |
101 | 101 | ||
102 | lists_insert(config.clone(), String::from("UL_R_LIST"), String::from("UL_R_MC"), Modloader::Fabric).unwrap(); | 102 | lists_insert(config.clone(), String::from("UL_R_LIST"), String::from("UL_R_MC"), Modloader::Fabric, String::from("UL_R_FOLDER")).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(); | 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(); | 104 | let ids = userlist_get_all_ids(config.clone(), String::from("UL_R_LIST")).unwrap(); |
105 | assert!(ids.contains(&String::from("UL_R"))); | 105 | assert!(ids.contains(&String::from("UL_R"))); |
@@ -111,7 +111,7 @@ fn test_userlist_remove() { | |||
111 | fn test_userlist_get_applicable_versions() { | 111 | fn test_userlist_get_applicable_versions() { |
112 | let config = setup(); | 112 | let config = setup(); |
113 | 113 | ||
114 | lists_insert(config.clone(), String::from("UL_GAV_LIST"), String::from("UL_GAV_MC"), Modloader::Fabric).unwrap(); | 114 | lists_insert(config.clone(), String::from("UL_GAV_LIST"), String::from("UL_GAV_MC"), Modloader::Fabric, String::from("UL_GAV_FOLDER")).unwrap(); |
115 | 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 | 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(); |
116 | 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 | 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")); |
117 | } | 117 | } |
@@ -120,7 +120,7 @@ fn test_userlist_get_applicable_versions() { | |||
120 | fn test_userlist_get_all_current_version_ids() { | 120 | fn test_userlist_get_all_current_version_ids() { |
121 | let config = setup(); | 121 | let config = setup(); |
122 | 122 | ||
123 | lists_insert(config.clone(), String::from("UL_GACVI_LIST"), String::from("UL_GACVI_MC"), Modloader::Fabric).unwrap(); | 123 | lists_insert(config.clone(), String::from("UL_GACVI_LIST"), String::from("UL_GACVI_MC"), Modloader::Fabric, String::from("UL_GACVI_FOLDER")).unwrap(); |
124 | 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_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(); |
125 | 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 | 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(); |
126 | 126 | ||
@@ -134,7 +134,7 @@ fn test_userlist_get_all_current_version_ids() { | |||
134 | fn test_userlist_change_versions() { | 134 | fn test_userlist_change_versions() { |
135 | let config = setup(); | 135 | let config = setup(); |
136 | 136 | ||
137 | lists_insert(config.clone(), String::from("UL_CV_LIST"), String::from("UL_CV_MC"), Modloader::Fabric).unwrap(); | 137 | lists_insert(config.clone(), String::from("UL_CV_LIST"), String::from("UL_CV_MC"), Modloader::Fabric, String::from("UL_CV_FOLDER")).unwrap(); |
138 | 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 | 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(); |
139 | let versions = userlist_get_all_current_version_ids(config.clone(), String::from("UL_CV_LIST")).unwrap(); | 139 | let versions = userlist_get_all_current_version_ids(config.clone(), String::from("UL_CV_LIST")).unwrap(); |
140 | assert!(versions.contains(&String::from("UL_CV_VER1"))); | 140 | assert!(versions.contains(&String::from("UL_CV_VER1"))); |
@@ -149,7 +149,7 @@ fn test_userlist_change_versions() { | |||
149 | fn test_userlist_get_all_downloads() { | 149 | fn test_userlist_get_all_downloads() { |
150 | let config = setup(); | 150 | let config = setup(); |
151 | 151 | ||
152 | lists_insert(config.clone(), String::from("UL_GAD_LIST"), String::from("UL_GAD_MC"), Modloader::Fabric).unwrap(); | 152 | lists_insert(config.clone(), String::from("UL_GAD_LIST"), String::from("UL_GAD_MC"), Modloader::Fabric, String::from("UL_GAD_FOLDER")).unwrap(); |
153 | 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_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(); |
154 | 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 | 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(); |
155 | let links = userlist_get_all_downloads(config, String::from("UL_GAD_LIST")).unwrap(); | 155 | let links = userlist_get_all_downloads(config, String::from("UL_GAD_LIST")).unwrap(); |
@@ -164,14 +164,14 @@ fn test_userlist_get_all_downloads() { | |||
164 | fn test_lists_insert() { | 164 | fn test_lists_insert() { |
165 | let config = setup(); | 165 | let config = setup(); |
166 | 166 | ||
167 | lists_insert(config, String::from("L_I_LIST"), String::from("L_I_MC"), Modloader::Fabric).unwrap(); | 167 | lists_insert(config, String::from("L_I_LIST"), String::from("L_I_MC"), Modloader::Fabric, String::from("L_I_FOLDER")).unwrap(); |
168 | } | 168 | } |
169 | 169 | ||
170 | #[test] | 170 | #[test] |
171 | fn test_lists_remove() { | 171 | fn test_lists_remove() { |
172 | let config = setup(); | 172 | let config = setup(); |
173 | 173 | ||
174 | lists_insert(config.clone(), String::from("L_R_LIST"), String::from("L_R_MC"), Modloader::Fabric).unwrap(); | 174 | lists_insert(config.clone(), String::from("L_R_LIST"), String::from("L_R_MC"), Modloader::Fabric, String::from("L_R_FOLDER")).unwrap(); |
175 | lists_remove(config, String::from("L_R_LIST")).unwrap(); | 175 | lists_remove(config, String::from("L_R_LIST")).unwrap(); |
176 | } | 176 | } |
177 | 177 | ||
@@ -179,17 +179,17 @@ fn test_lists_remove() { | |||
179 | fn test_lists_get() { | 179 | fn test_lists_get() { |
180 | let config = setup(); | 180 | let config = setup(); |
181 | 181 | ||
182 | lists_insert(config.clone(), String::from("L_G_LIST"), String::from("L_G_MC"), Modloader::Fabric).unwrap(); | 182 | lists_insert(config.clone(), String::from("L_G_LIST"), String::from("L_G_MC"), Modloader::Fabric, String::from("L_G_FOLDER")).unwrap(); |
183 | 183 | ||
184 | 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 | 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, download_folder: String::from("L_G_FOLDER") }); |
185 | } | 185 | } |
186 | 186 | ||
187 | #[test] | 187 | #[test] |
188 | fn test_lists_get_all_ids() { | 188 | fn test_lists_get_all_ids() { |
189 | let config = setup(); | 189 | let config = setup(); |
190 | 190 | ||
191 | 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_GAI1_LIST"), String::from("L_GAI1_MC"), Modloader::Fabric, String::from("L_GAI1_FOLDER")).unwrap(); |
192 | lists_insert(config.clone(), String::from("L_GAI2_LIST"), String::from("L_GAI2_MC"), Modloader::Fabric).unwrap(); | 192 | lists_insert(config.clone(), String::from("L_GAI2_LIST"), String::from("L_GAI2_MC"), Modloader::Fabric, String::from("L_GAI2_FOLDER")).unwrap(); |
193 | let ids = lists_get_all_ids(config).unwrap(); | 193 | let ids = lists_get_all_ids(config).unwrap(); |
194 | 194 | ||
195 | assert!(ids.contains(&String::from("L_GAI1_LIST"))); | 195 | assert!(ids.contains(&String::from("L_GAI1_LIST"))); |
@@ -217,7 +217,7 @@ fn test_config_get_current_list() { | |||
217 | fn test_s_userlist_update_download() { | 217 | fn test_s_userlist_update_download() { |
218 | let config = setup(); | 218 | let config = setup(); |
219 | 219 | ||
220 | lists_insert(config.clone(), String::from("UL_UD_LIST"), String::from("UL_UD_MC"), Modloader::Fabric).unwrap(); | 220 | lists_insert(config.clone(), String::from("UL_UD_LIST"), String::from("UL_UD_MC"), Modloader::Fabric, String::from("UL_UD_FOLDER")).unwrap(); |
221 | 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 | 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(); |
222 | 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 | 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(); |
223 | let links = userlist_get_all_downloads(config, String::from("UL_UD_LIST")).unwrap(); | 223 | let links = userlist_get_all_downloads(config, String::from("UL_UD_LIST")).unwrap(); |