Add openai tests

This commit is contained in:
Louis Dureuil 2024-07-30 15:43:40 +02:00
parent 1c755c8899
commit abdb337fd6
No known key found for this signature in database
3 changed files with 1780 additions and 18 deletions

View File

@ -1,3 +1,4 @@
mod openai;
mod rest;
mod settings;
@ -7,6 +8,22 @@ use crate::common::index::Index;
use crate::common::{GetAllDocumentsOptions, Server};
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]
async fn add_remove_user_provided() {
let server = Server::new().await;

File diff suppressed because it is too large Load Diff

View File

@ -5,9 +5,9 @@ use reqwest::IntoUrl;
use wiremock::matchers::{method, path};
use wiremock::{Mock, MockServer, Request, ResponseTemplate};
use crate::common::{Server, Value};
use crate::common::Value;
use crate::json;
use crate::vector::GetAllDocumentsOptions;
use crate::vector::{get_server_vector, GetAllDocumentsOptions};
async fn create_mock() -> (MockServer, Value) {
let mock_server = MockServer::start().await;
@ -265,22 +265,6 @@ async fn dummy_testing_the_mock() {
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]
async fn bad_request() {
let (mock, _setting) = create_mock().await;