summaryrefslogtreecommitdiff
path: root/tests/db.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/db.rs')
-rw-r--r--tests/db.rs28
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() {
78fn test_userlist_insert() { 78fn 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() {
86fn test_userlist_get_all_ids() { 86fn 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() {
99fn test_userlist_remove() { 99fn 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() {
111fn test_userlist_get_applicable_versions() { 111fn 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() {
120fn test_userlist_get_all_current_version_ids() { 120fn 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() {
134fn test_userlist_change_versions() { 134fn 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() {
149fn test_userlist_get_all_downloads() { 149fn 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() {
164fn test_lists_insert() { 164fn 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]
171fn test_lists_remove() { 171fn 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() {
179fn test_lists_get() { 179fn 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]
188fn test_lists_get_all_ids() { 188fn 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() {
217fn test_s_userlist_update_download() { 217fn 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();