Added support for specifying compression in tests

Refactored tests code to allow to specify compression (content-encoding) algorithm.

Added tests to verify what actix actually handle different content encodings properly.
This commit is contained in:
Andrey "MOU" Larionov 2022-10-09 19:43:51 +02:00
parent 7607a62531
commit 11b986a81d
No known key found for this signature in database
GPG key ID: 5FF293FC94C01D6A
9 changed files with 224 additions and 128 deletions

View file

@ -1,3 +1,4 @@
use crate::common::encoder::Encoder;
use crate::common::Server;
use serde_json::json;
use time::{format_description::well_known::Rfc3339, OffsetDateTime};
@ -34,6 +35,22 @@ async fn update_primary_key() {
assert_eq!(response.as_object().unwrap().len(), 4);
}
#[actix_rt::test]
async fn create_and_update_with_different_encoding() {
let server = Server::new().await;
let index = server.index_with_encoder("test", Encoder::Gzip);
let (_, code) = index.create(None).await;
assert_eq!(code, 202);
let index = server.index_with_encoder("test", Encoder::Brotli);
index.update(Some("primary")).await;
let response = index.wait_task(1).await;
assert_eq!(response["status"], "succeeded");
}
#[actix_rt::test]
async fn update_nothing() {
let server = Server::new().await;