You've already forked AstralRinth
forked from didirus/AstralRinth
Search test + v3 (#731)
* search patch for accurate loader/gv filtering * backup * basic search test * finished test * incomplete commit; backing up * Working multipat reroute backup * working rough draft v3 * most tests passing * works * search v2 conversion * added some tags.rs v2 conversions * Worked through warnings, unwraps, prints * refactors * new search test * version files changes fixes * redesign to revs * removed old caches * removed games * fmt clippy * merge conflicts * fmt, prepare * moved v2 routes over to v3 * fixes; tests passing * project type changes * moved files over * fmt, clippy, prepare, etc * loaders to loader_fields, added tests * fmt, clippy, prepare * fixed sorting bug * reversed back- wrong order for consistency * fmt; clippy; prepare --------- Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
use actix_web::test::{self, TestRequest};
|
||||
use bytes::Bytes;
|
||||
use chrono::{Duration, Utc};
|
||||
use common::actix::AppendsMultipart;
|
||||
use labrinth::models::pats::Scopes;
|
||||
use labrinth::util::actix::{AppendsMultipart, MultipartSegment, MultipartSegmentData};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::common::{database::*, environment::TestEnvironment, scopes::ScopeTest};
|
||||
@@ -225,19 +225,17 @@ pub async fn project_version_create_scopes() {
|
||||
"license_id": "MIT"
|
||||
}
|
||||
);
|
||||
let json_segment = common::actix::MultipartSegment {
|
||||
let json_segment = MultipartSegment {
|
||||
name: "data".to_string(),
|
||||
filename: None,
|
||||
content_type: Some("application/json".to_string()),
|
||||
data: common::actix::MultipartSegmentData::Text(serde_json::to_string(&json_data).unwrap()),
|
||||
data: MultipartSegmentData::Text(serde_json::to_string(&json_data).unwrap()),
|
||||
};
|
||||
let file_segment = common::actix::MultipartSegment {
|
||||
let file_segment = MultipartSegment {
|
||||
name: "basic-mod.jar".to_string(),
|
||||
filename: Some("basic-mod.jar".to_string()),
|
||||
content_type: Some("application/java-archive".to_string()),
|
||||
data: common::actix::MultipartSegmentData::Binary(
|
||||
include_bytes!("../tests/files/basic-mod.jar").to_vec(),
|
||||
),
|
||||
data: MultipartSegmentData::Binary(include_bytes!("../tests/files/basic-mod.jar").to_vec()),
|
||||
};
|
||||
|
||||
let req_gen = || {
|
||||
@@ -266,17 +264,17 @@ pub async fn project_version_create_scopes() {
|
||||
"featured": true
|
||||
}
|
||||
);
|
||||
let json_segment = common::actix::MultipartSegment {
|
||||
let json_segment = MultipartSegment {
|
||||
name: "data".to_string(),
|
||||
filename: None,
|
||||
content_type: Some("application/json".to_string()),
|
||||
data: common::actix::MultipartSegmentData::Text(serde_json::to_string(&json_data).unwrap()),
|
||||
data: MultipartSegmentData::Text(serde_json::to_string(&json_data).unwrap()),
|
||||
};
|
||||
let file_segment = common::actix::MultipartSegment {
|
||||
let file_segment = MultipartSegment {
|
||||
name: "basic-mod-different.jar".to_string(),
|
||||
filename: Some("basic-mod.jar".to_string()),
|
||||
content_type: Some("application/java-archive".to_string()),
|
||||
data: common::actix::MultipartSegmentData::Binary(
|
||||
data: MultipartSegmentData::Binary(
|
||||
include_bytes!("../tests/files/basic-mod-different.jar").to_vec(),
|
||||
),
|
||||
};
|
||||
@@ -819,11 +817,11 @@ pub async fn version_write_scopes() {
|
||||
|
||||
// Generate test project data.
|
||||
// Basic json
|
||||
let json_segment = common::actix::MultipartSegment {
|
||||
let json_segment = MultipartSegment {
|
||||
name: "data".to_string(),
|
||||
filename: None,
|
||||
content_type: Some("application/json".to_string()),
|
||||
data: common::actix::MultipartSegmentData::Text(
|
||||
data: MultipartSegmentData::Text(
|
||||
serde_json::to_string(&json!(
|
||||
{
|
||||
"file_types": {
|
||||
@@ -836,11 +834,11 @@ pub async fn version_write_scopes() {
|
||||
};
|
||||
|
||||
// Differently named file, with different content
|
||||
let content_segment = common::actix::MultipartSegment {
|
||||
let content_segment = MultipartSegment {
|
||||
name: "simple-zip.zip".to_string(),
|
||||
filename: Some("simple-zip.zip".to_string()),
|
||||
content_type: Some("application/zip".to_string()),
|
||||
data: common::actix::MultipartSegmentData::Binary(
|
||||
data: MultipartSegmentData::Binary(
|
||||
include_bytes!("../tests/files/simple-zip.zip").to_vec(),
|
||||
),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user