diff --git a/backend/modules/prompt/tests/test_prompt.py b/backend/modules/prompt/tests/test_prompt.py index 59ac7ab10..384e9098e 100644 --- a/backend/modules/prompt/tests/test_prompt.py +++ b/backend/modules/prompt/tests/test_prompt.py @@ -1,3 +1,11 @@ +import uuid + +import pytest +from fastapi import HTTPException +from modules.prompt.repository.prompts import Prompts +from modules.prompt.service.prompt_service import DeletePromptResponse + + def test_get_public_prompts(client, api_key): response = client.get( "/prompts", @@ -5,3 +13,30 @@ def test_get_public_prompts(client, api_key): ) assert response.status_code == 200 assert len(response.json()) == 0 + + +def test_delete_prompt_by_id(): + # Arrange + prompts = Prompts() + prompt_id = uuid.uuid4() # Generate a valid UUID + + # Act + result = prompts.delete_prompt_by_id(prompt_id) + + # Assert + assert isinstance(result, DeletePromptResponse) + assert result.status == "deleted" + assert result.prompt_id == prompt_id + + +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"