Fix formatting and apply clippy suggestion

This commit is contained in:
Andrey "MOU" Larionov 2022-10-10 11:04:46 +02:00
parent 9dbc71cb6d
commit 343a677566
No known key found for this signature in database
GPG key ID: 5FF293FC94C01D6A
4 changed files with 28 additions and 17 deletions

View file

@ -1,10 +1,10 @@
use crate::common::{GetAllDocumentsOptions, Server};
use actix_web::test;
use crate::common::encoder::Encoder;
use meilisearch_http::{analytics, create_app};
use serde_json::{json, Value};
use time::{format_description::well_known::Rfc3339, OffsetDateTime};
use crate::common::encoder::Encoder;
/// This is the basic usage of our API and every other tests uses the content-type application/json
#[actix_rt::test]
@ -115,7 +115,7 @@ async fn add_single_document_gzip_encoded() {
server.service.options,
analytics::MockAnalytics::new(&server.service.options).0
))
.await;
.await;
// post
let document = serde_json::to_string(&document).unwrap();
let encoder = Encoder::Gzip;
@ -164,19 +164,18 @@ async fn add_single_document_with_every_encoding() {
server.service.options,
analytics::MockAnalytics::new(&server.service.options).0
))
.await;
.await;
// post
let mut task_uid = 0;
let document = serde_json::to_string(&document).unwrap();
for encoder in Encoder::iterator() {
for (task_uid, encoder) in Encoder::iterator().enumerate() {
let mut req = test::TestRequest::post()
.uri("/indexes/dog/documents")
.set_payload(encoder.encode(document.clone()))
.insert_header(("content-type", "application/json"));
req = match encoder.header() {
Some(header) => req.insert_header(header),
None => req
None => req,
};
let req = req.to_request();
let res = test::call_service(&app, req).await;
@ -185,9 +184,7 @@ async fn add_single_document_with_every_encoding() {
let response: Value = serde_json::from_slice(&body).unwrap_or_default();
assert_eq!(status_code, 202);
assert_eq!(response["taskUid"], task_uid);
task_uid += 1;
}
}
/// any other content-type is must be refused

View file

@ -1,7 +1,7 @@
use crate::common::{GetAllDocumentsOptions, Server};
use serde_json::json;
use crate::common::encoder::Encoder;
use serde_json::json;
#[actix_rt::test]
async fn error_document_update_create_index_bad_uid() {