Skip to content

Commit

Permalink
Change documents parameter to Sequence[Dict[str, Any]], add simple /o…
Browse files Browse the repository at this point in the history
…penapi.json and /docs resource is there test
  • Loading branch information
gabauer committed Oct 7, 2024
1 parent fcbc982 commit dd10436
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/marqo/api/models/add_docs_objects.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import List
from typing import Optional, Union, Any, Sequence
from typing import List, Dict
from typing import Optional, Any, Sequence

import numpy as np
from pydantic import BaseModel, root_validator
from pydantic import Field

Expand All @@ -24,7 +23,7 @@ class Config:
imageDownloadHeaders: dict = Field(default_factory=dict)
modelAuth: Optional[ModelAuth] = None
mappings: Optional[dict] = None
documents: Union[Sequence[Union[dict, Any]], np.ndarray]
documents: Sequence[Dict[str, Any]]
imageDownloadThreadCount: int = Field(default_factory=lambda: read_env_vars_and_defaults_ints(EnvVars.MARQO_IMAGE_DOWNLOAD_THREAD_COUNT_PER_REQUEST))
mediaDownloadThreadCount: Optional[int]
textChunkPrefix: Optional[str] = None
Expand Down
18 changes: 18 additions & 0 deletions tests/tensor_search/test_openapi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from fastapi.testclient import TestClient
from marqo.tensor_search.api import app
from tests.marqo_test import MarqoTestCase


class OpenApiTests(MarqoTestCase):
def setUp(self):
self.client = TestClient(app)

def test_docs_endpoint(self):
"""Test if the /docs endpoint is accessible and returns status code 200."""
response = self.client.get("/docs")
self.assertEqual(response.status_code, 200, "The /docs endpoint should be accessible.")

def test_openapi_json_endpoint(self):
"""Test if the /openapi.json endpoint is accessible and returns status code 200."""
response = self.client.get("/openapi.json")
self.assertEqual(response.status_code, 200, "The /openapi.json endpoint should be accessible.")

0 comments on commit dd10436

Please sign in to comment.