mirror of https://github.com/ChillFish8/lust.git
Add more robust testing across settings
This commit is contained in:
parent
8acb8690fa
commit
e96f8c4d98
|
@ -1,4 +1,3 @@
|
|||
use anyhow::anyhow;
|
||||
use bytes::Bytes;
|
||||
use hashbrown::HashMap;
|
||||
|
||||
|
|
62
src/tests.rs
62
src/tests.rs
|
@ -69,21 +69,21 @@ async fn test_basic_aot_upload_retrieval_without_guessing() -> anyhow::Result<()
|
|||
.await;
|
||||
|
||||
res.assert_status(StatusCode::OK);
|
||||
// let info = res.json().await;
|
||||
//
|
||||
// let file_id = info
|
||||
// .value()
|
||||
// .object()
|
||||
// .get("image_id")
|
||||
// .string();
|
||||
//
|
||||
// let res = app.get(format!("/v1/user-profiles/{}", file_id))
|
||||
// .send()
|
||||
// .await;
|
||||
//
|
||||
// res.assert_status(StatusCode::OK);
|
||||
// res.assert_content_type(&"image/png".to_string());
|
||||
//
|
||||
let info = res.json().await;
|
||||
|
||||
let file_id = info
|
||||
.value()
|
||||
.object()
|
||||
.get("image_id")
|
||||
.string();
|
||||
|
||||
let res = app.get(format!("/v1/user-profiles/{}", file_id))
|
||||
.send()
|
||||
.await;
|
||||
|
||||
res.assert_status(StatusCode::OK);
|
||||
res.assert_content_type(&"image/webp".to_string());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -100,20 +100,20 @@ async fn test_basic_aot_upload_retrieval_with_guessing() -> anyhow::Result<()> {
|
|||
.await;
|
||||
|
||||
res.assert_status(StatusCode::OK);
|
||||
// let info = res.json().await;
|
||||
//
|
||||
// let file_id = info
|
||||
// .value()
|
||||
// .object()
|
||||
// .get("image_id")
|
||||
// .string();
|
||||
//
|
||||
// let res = app.get(format!("/v1/user-profiles/{}", file_id))
|
||||
// .send()
|
||||
// .await;
|
||||
//
|
||||
// res.assert_status(StatusCode::OK);
|
||||
// res.assert_content_type(&"image/png".to_string());
|
||||
let info = res.json().await;
|
||||
|
||||
let file_id = info
|
||||
.value()
|
||||
.object()
|
||||
.get("image_id")
|
||||
.string();
|
||||
|
||||
let res = app.get(format!("/v1/user-profiles/{}", file_id))
|
||||
.send()
|
||||
.await;
|
||||
|
||||
res.assert_status(StatusCode::OK);
|
||||
res.assert_content_type(&"image/webp".to_string());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ async fn test_basic_realtime_upload_retrieval() -> anyhow::Result<()> {
|
|||
.await;
|
||||
|
||||
res.assert_status(StatusCode::OK);
|
||||
res.assert_content_type(&"image/jpeg".to_string());
|
||||
res.assert_content_type(&"image/png".to_string());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ async fn test_realtime_resizing() -> anyhow::Result<()> {
|
|||
.await;
|
||||
|
||||
res.assert_status(StatusCode::OK);
|
||||
res.assert_content_type(&"image/jpeg".to_string());
|
||||
res.assert_content_type(&"image/png".to_string());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ buckets:
|
|||
user-profiles: # Define a bucket called "user-profiles", this is accessable out of `/images/user-profiles`.
|
||||
mode: aot # Optimise images as and when they're required then store them.
|
||||
formats:
|
||||
png: true # Disable PNG encoding.
|
||||
png: true # Enable PNG encoding.
|
||||
jpeg: true # Enable JPEG encoding.
|
||||
webp: false # Enable WebP encoding.
|
||||
webp: true # Enable WebP encoding.
|
||||
gif: false # Disable GIF encoding.
|
||||
|
||||
webp_config:
|
||||
|
@ -21,7 +21,7 @@ buckets:
|
|||
method: 4 # Opt on the side of performance slightly more than quality.
|
||||
threading: true # Enable multi-threaded encoding.
|
||||
|
||||
default_serving_format: jpeg # Serve the WebP format by default.
|
||||
default_serving_format: webp # Serve the WebP format by default.
|
||||
default_serving_preset: medium-square # Use the "medium-square" sizing preset by default.
|
||||
|
||||
presets:
|
||||
|
|
|
@ -13,15 +13,17 @@ buckets:
|
|||
formats:
|
||||
png: true # Disable PNG encoding.
|
||||
jpeg: true # Enable JPEG encoding.
|
||||
webp: false # Enable WebP encoding.
|
||||
webp: true # Enable WebP encoding.
|
||||
gif: false # Disable GIF encoding.
|
||||
|
||||
original_image_store_format: jpeg
|
||||
|
||||
webp_config:
|
||||
quality: 80 # Set lossy quality to 80%
|
||||
method: 4 # Opt on the side of performance slightly more than quality.
|
||||
threading: true # Enable multi-threaded encoding.
|
||||
|
||||
default_serving_format: jpeg # Serve the WebP format by default.
|
||||
default_serving_format: png # Serve the WebP format by default.
|
||||
default_serving_preset: medium-square # Use the "medium-square" sizing preset by default.
|
||||
|
||||
presets:
|
||||
|
|
Loading…
Reference in New Issue