quivr/backend/modules/prompt/tests/test_prompt.py
Stan Girard 03c49693b7
feat(chunks): now chunk size is saved in database dynamically and not just 500 (#2164)
# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
2024-02-06 23:23:37 -08:00

28 lines
710 B
Python

import uuid
import pytest
from fastapi import HTTPException
from modules.prompt.repository.prompts import Prompts
def test_get_public_prompts(client, api_key):
response = client.get(
"/prompts",
headers={"Authorization": "Bearer " + api_key},
)
assert response.status_code == 200
assert len(response.json()) == 0
def test_delete_prompt_by_id_not_found():
# Arrange
prompts = Prompts()
prompt_id = uuid.uuid4() # Generate a valid UUID
# Act and Assert
with pytest.raises(HTTPException) as exc_info:
prompts.delete_prompt_by_id(prompt_id)
assert exc_info.value.status_code == 404
assert str(exc_info.value.detail) == "Prompt not found"