mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-19 12:21:46 +03:00
03c49693b7
# 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):
28 lines
710 B
Python
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"
|