mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 00:31:02 +00:00
run cargo fmt
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
use std::error::Error;
|
||||
use std::time::Duration;
|
||||
|
||||
use async_std::task::{block_on, sleep};
|
||||
use http_service::Body;
|
||||
use http_service_mock::{make_server, TestBackend};
|
||||
use meilisearch_http::data::Data;
|
||||
@ -10,7 +11,6 @@ use meilisearch_http::routes;
|
||||
use serde_json::json;
|
||||
use tempdir::TempDir;
|
||||
use tide::server::Service;
|
||||
use async_std::task::{block_on, sleep};
|
||||
|
||||
pub fn setup_server() -> Result<TestBackend<Service<Data>>, Box<dyn Error>> {
|
||||
let tmp_dir = TempDir::new("meilisearch")?;
|
||||
@ -29,13 +29,18 @@ pub fn setup_server() -> Result<TestBackend<Service<Data>>, Box<dyn Error>> {
|
||||
Ok(make_server(http_server)?)
|
||||
}
|
||||
|
||||
pub fn enrich_server_with_movies_index(server: &mut TestBackend<Service<Data>>) -> Result<(), Box<dyn Error>> {
|
||||
|
||||
pub fn enrich_server_with_movies_index(
|
||||
server: &mut TestBackend<Service<Data>>,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
let body = json!({
|
||||
"uid": "movies",
|
||||
}).to_string().into_bytes();
|
||||
})
|
||||
.to_string()
|
||||
.into_bytes();
|
||||
|
||||
let req = http::Request::post("/indexes").body(Body::from(body)).unwrap();
|
||||
let req = http::Request::post("/indexes")
|
||||
.body(Body::from(body))
|
||||
.unwrap();
|
||||
let res = server.simulate(req).unwrap();
|
||||
|
||||
println!("enrich_server_with_movies_index: {:?}", res.status());
|
||||
@ -43,8 +48,9 @@ pub fn enrich_server_with_movies_index(server: &mut TestBackend<Service<Data>>)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn enrich_server_with_movies_settings(server: &mut TestBackend<Service<Data>>) -> Result<(), Box<dyn Error>> {
|
||||
|
||||
pub fn enrich_server_with_movies_settings(
|
||||
server: &mut TestBackend<Service<Data>>,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
let json = json!({
|
||||
"rankingRules": [
|
||||
"_typo",
|
||||
@ -87,7 +93,9 @@ pub fn enrich_server_with_movies_settings(server: &mut TestBackend<Service<Data>
|
||||
|
||||
let body = json.to_string().into_bytes();
|
||||
|
||||
let req = http::Request::post("/indexes/movies/settings").body(Body::from(body)).unwrap();
|
||||
let req = http::Request::post("/indexes/movies/settings")
|
||||
.body(Body::from(body))
|
||||
.unwrap();
|
||||
let res = server.simulate(req).unwrap();
|
||||
|
||||
println!("enrich_server_with_movies_settings: {:?}", res.status());
|
||||
@ -97,11 +105,14 @@ pub fn enrich_server_with_movies_settings(server: &mut TestBackend<Service<Data>
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn enrich_server_with_movies_documents(server: &mut TestBackend<Service<Data>>) -> Result<(), Box<dyn Error>> {
|
||||
|
||||
pub fn enrich_server_with_movies_documents(
|
||||
server: &mut TestBackend<Service<Data>>,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
let body = include_bytes!("assets/movies.json").to_vec();
|
||||
|
||||
let req = http::Request::post("/indexes/movies/documents").body(Body::from(body)).unwrap();
|
||||
let req = http::Request::post("/indexes/movies/documents")
|
||||
.body(Body::from(body))
|
||||
.unwrap();
|
||||
let res = server.simulate(req).unwrap();
|
||||
|
||||
println!("enrich_server_with_movies_documents: {:?}", res.status());
|
||||
@ -110,4 +121,3 @@ pub fn enrich_server_with_movies_documents(server: &mut TestBackend<Service<Data
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user