patch tags
This commit is contained in:
@@ -22,6 +22,7 @@ struct DocumentInfo {
|
||||
deleted_at: Option<String>,
|
||||
issued_at: Option<String>,
|
||||
tags: Vec<TagSummary>,
|
||||
download_path: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -42,6 +43,7 @@ struct DocumentAssetInfo {
|
||||
struct DocumentListItem {
|
||||
id: Uuid,
|
||||
current_version: i32,
|
||||
download_path: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -154,6 +156,7 @@ async fn upload_and_list_document() -> Result<()> {
|
||||
assert_eq!(detail.document.deleted_at, None);
|
||||
assert!(detail.document.issued_at.is_none());
|
||||
assert!(detail.document.tags.is_empty());
|
||||
assert!(detail.document.download_path.starts_with("/download/"));
|
||||
assert_eq!(detail.current_version.size_bytes, file_bytes.len() as i64);
|
||||
assert!(detail.assets.is_empty());
|
||||
|
||||
@@ -173,6 +176,7 @@ async fn upload_and_list_document() -> Result<()> {
|
||||
let item = list.pop().unwrap();
|
||||
assert_eq!(item.id, detail.document.id);
|
||||
assert_eq!(item.current_version, 1);
|
||||
assert!(item.download_path.starts_with("/download/"));
|
||||
|
||||
let download = app
|
||||
.get(
|
||||
@@ -186,6 +190,15 @@ async fn upload_and_list_document() -> Result<()> {
|
||||
assert!(download_info.url.contains(&detail.current_version.s3_key));
|
||||
assert_eq!(download_info.filename, "doc.txt");
|
||||
|
||||
let redirect = app.get(&detail.document.download_path, None).await?;
|
||||
assert_eq!(redirect.status(), StatusCode::TEMPORARY_REDIRECT);
|
||||
let location = redirect
|
||||
.headers()
|
||||
.get("location")
|
||||
.expect("redirect location header");
|
||||
let location = location.to_str().expect("location header utf8");
|
||||
assert!(location.contains(&detail.current_version.s3_key));
|
||||
|
||||
app.cleanup().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user