mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-29 08:35:15 +08:00
Add openai tests
This commit is contained in:
parent
1c755c8899
commit
abdb337fd6
@ -1,3 +1,4 @@
|
|||||||
|
mod openai;
|
||||||
mod rest;
|
mod rest;
|
||||||
mod settings;
|
mod settings;
|
||||||
|
|
||||||
@ -7,6 +8,22 @@ use crate::common::index::Index;
|
|||||||
use crate::common::{GetAllDocumentsOptions, Server};
|
use crate::common::{GetAllDocumentsOptions, Server};
|
||||||
use crate::json;
|
use crate::json;
|
||||||
|
|
||||||
|
async fn get_server_vector() -> Server {
|
||||||
|
let server = Server::new().await;
|
||||||
|
let (value, code) = server.set_features(json!({"vectorStore": true})).await;
|
||||||
|
snapshot!(code, @"200 OK");
|
||||||
|
snapshot!(value, @r###"
|
||||||
|
{
|
||||||
|
"vectorStore": true,
|
||||||
|
"metrics": false,
|
||||||
|
"logsRoute": false,
|
||||||
|
"editDocumentsByFunction": false,
|
||||||
|
"containsFilter": false
|
||||||
|
}
|
||||||
|
"###);
|
||||||
|
server
|
||||||
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn add_remove_user_provided() {
|
async fn add_remove_user_provided() {
|
||||||
let server = Server::new().await;
|
let server = Server::new().await;
|
||||||
|
1761
meilisearch/tests/vector/openai.rs
Normal file
1761
meilisearch/tests/vector/openai.rs
Normal file
File diff suppressed because it is too large
Load Diff
@ -5,9 +5,9 @@ use reqwest::IntoUrl;
|
|||||||
use wiremock::matchers::{method, path};
|
use wiremock::matchers::{method, path};
|
||||||
use wiremock::{Mock, MockServer, Request, ResponseTemplate};
|
use wiremock::{Mock, MockServer, Request, ResponseTemplate};
|
||||||
|
|
||||||
use crate::common::{Server, Value};
|
use crate::common::Value;
|
||||||
use crate::json;
|
use crate::json;
|
||||||
use crate::vector::GetAllDocumentsOptions;
|
use crate::vector::{get_server_vector, GetAllDocumentsOptions};
|
||||||
|
|
||||||
async fn create_mock() -> (MockServer, Value) {
|
async fn create_mock() -> (MockServer, Value) {
|
||||||
let mock_server = MockServer::start().await;
|
let mock_server = MockServer::start().await;
|
||||||
@ -265,22 +265,6 @@ async fn dummy_testing_the_mock() {
|
|||||||
snapshot!(body, @r###"{"data":[4,4,4]}"###);
|
snapshot!(body, @r###"{"data":[4,4,4]}"###);
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_server_vector() -> Server {
|
|
||||||
let server = Server::new().await;
|
|
||||||
let (value, code) = server.set_features(json!({"vectorStore": true})).await;
|
|
||||||
snapshot!(code, @"200 OK");
|
|
||||||
snapshot!(value, @r###"
|
|
||||||
{
|
|
||||||
"vectorStore": true,
|
|
||||||
"metrics": false,
|
|
||||||
"logsRoute": false,
|
|
||||||
"editDocumentsByFunction": false,
|
|
||||||
"containsFilter": false
|
|
||||||
}
|
|
||||||
"###);
|
|
||||||
server
|
|
||||||
}
|
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn bad_request() {
|
async fn bad_request() {
|
||||||
let (mock, _setting) = create_mock().await;
|
let (mock, _setting) = create_mock().await;
|
||||||
|
Loading…
Reference in New Issue
Block a user