This commit is contained in:
2025-10-31 02:19:38 +01:00
parent f796932cd8
commit eacab2ced6
7 changed files with 462 additions and 17 deletions
+8 -8
View File
@@ -29,7 +29,7 @@ use papercrate::state::AppState;
use papercrate::storage::ObjectStorage;
use rand::rngs::OsRng;
use rand::RngCore;
use serde::{Deserialize, Serialize};
use serde::Serialize;
use serde_json::{self, json};
use sha2::{Digest, Sha256};
use tokio::sync::Mutex;
@@ -122,13 +122,6 @@ pub struct TestApp {
storage: Arc<FakeStorage>,
}
#[derive(Debug, Deserialize)]
pub struct ApiErrorResponse {
pub error: String,
#[serde(default)]
pub code: Option<String>,
}
impl TestApp {
pub async fn new() -> Result<Self> {
let database_url = env::var("TEST_DATABASE_URL")
@@ -625,6 +618,13 @@ impl TestApp {
body.extend(b"\r\n");
}
if let Some(document_type_id) = extras.document_type_id {
body.extend(format!("--{boundary}\r\n").as_bytes());
body.extend(b"Content-Disposition: form-data; name=\"document_type_id\"\r\n\r\n");
body.extend(document_type_id.to_string().as_bytes());
body.extend(b"\r\n");
}
if extras.skip_existing {
body.extend(format!("--{boundary}\r\n").as_bytes());
body.extend(b"Content-Disposition: form-data; name=\"skip_existing\"\r\n\r\ntrue\r\n");