mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
test index delete
This commit is contained in:
parent
ed3f8f5cc0
commit
b293948d36
@ -33,4 +33,9 @@ impl Index<'_> {
|
||||
|
||||
self.service.put(url, body).await
|
||||
}
|
||||
|
||||
pub async fn delete(&self) -> (Value, StatusCode) {
|
||||
let url = format!("/indexes/{}", self.uid);
|
||||
self.service.delete(url).await
|
||||
}
|
||||
}
|
||||
|
@ -138,22 +138,6 @@ impl Server {
|
||||
|
||||
// Global Http request GET/POST/DELETE async or sync
|
||||
|
||||
//pub async fn get_request(&mut self, url: &str) -> (Value, StatusCode) {
|
||||
//eprintln!("get_request: {}", url);
|
||||
|
||||
//let mut app =
|
||||
//test::init_service(meilisearch_http::create_app(&self.data, true).wrap(NormalizePath)).await;
|
||||
|
||||
//let req = test::TestRequest::get().uri(url).to_request();
|
||||
//let res = test::call_service(&mut app, req).await;
|
||||
//let status_code = res.status();
|
||||
|
||||
//let body = test::read_body(res).await;
|
||||
//let response = serde_json::from_slice(&body).unwrap_or_default();
|
||||
//(response, status_code)
|
||||
//}
|
||||
|
||||
|
||||
//pub async fn post_request_async(&mut self, url: &str, body: Value) -> (Value, StatusCode) {
|
||||
//eprintln!("post_request_async: {}", url);
|
||||
|
||||
@ -177,20 +161,6 @@ impl Server {
|
||||
//(response, status_code)
|
||||
//}
|
||||
|
||||
//pub async fn delete_request(&mut self, url: &str) -> (Value, StatusCode) {
|
||||
//eprintln!("delete_request: {}", url);
|
||||
|
||||
//let mut app =
|
||||
//test::init_service(meilisearch_http::create_app(&self.data, true).wrap(NormalizePath)).await;
|
||||
|
||||
//let req = test::TestRequest::delete().uri(url).to_request();
|
||||
//let res = test::call_service(&mut app, req).await;
|
||||
//let status_code = res.status();
|
||||
|
||||
//let body = test::read_body(res).await;
|
||||
//let response = serde_json::from_slice(&body).unwrap_or_default();
|
||||
//(response, status_code)
|
||||
//}
|
||||
|
||||
//pub async fn delete_request_async(&mut self, url: &str) -> (Value, StatusCode) {
|
||||
//eprintln!("delete_request_async: {}", url);
|
||||
|
@ -51,5 +51,18 @@ impl Service {
|
||||
let response = serde_json::from_slice(&body).unwrap_or_default();
|
||||
(response, status_code)
|
||||
}
|
||||
|
||||
pub async fn delete(&self, url: impl AsRef<str>) -> (Value, StatusCode) {
|
||||
let mut app =
|
||||
test::init_service(meilisearch_http::create_app(&self.0, true).wrap(NormalizePath)).await;
|
||||
|
||||
let req = test::TestRequest::delete().uri(url.as_ref()).to_request();
|
||||
let res = test::call_service(&mut app, req).await;
|
||||
let status_code = res.status();
|
||||
|
||||
let body = test::read_body(res).await;
|
||||
let response = serde_json::from_slice(&body).unwrap_or_default();
|
||||
(response, status_code)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
mod create_index;
|
||||
mod get_index;
|
||||
mod update_index;
|
||||
mod delete_index;
|
||||
|
@ -1,3 +1,9 @@
|
||||
mod common;
|
||||
mod search;
|
||||
mod index;
|
||||
|
||||
// Tests are isolated by features in different modules to allow better readability, test
|
||||
// targetability, and improved incremental compilation times.
|
||||
//
|
||||
// All the integration tests live in the same root module so only one test executable is generated,
|
||||
// thus improving linking time.
|
||||
|
Loading…
Reference in New Issue
Block a user