add unit changes

This commit is contained in:
Matthew Farrellee 2025-08-18 16:31:36 -04:00
parent 76d45bb5b1
commit 6f91fb12a7

View file

@ -7,6 +7,7 @@
import pytest import pytest
from llama_stack.apis.common.errors import ResourceNotFoundError
from llama_stack.apis.common.responses import Order from llama_stack.apis.common.responses import Order
from llama_stack.apis.files import OpenAIFilePurpose from llama_stack.apis.files import OpenAIFilePurpose
from llama_stack.core.access_control.access_control import default_policy from llama_stack.core.access_control.access_control import default_policy
@ -190,7 +191,7 @@ class TestOpenAIFilesAPI:
async def test_retrieve_file_not_found(self, files_provider): async def test_retrieve_file_not_found(self, files_provider):
"""Test retrieving a non-existent file.""" """Test retrieving a non-existent file."""
with pytest.raises(ValueError, match="File with id file-nonexistent not found"): with pytest.raises(ResourceNotFoundError, match="not found"):
await files_provider.openai_retrieve_file("file-nonexistent") await files_provider.openai_retrieve_file("file-nonexistent")
async def test_retrieve_file_content_success(self, files_provider, sample_text_file): async def test_retrieve_file_content_success(self, files_provider, sample_text_file):
@ -208,7 +209,7 @@ class TestOpenAIFilesAPI:
async def test_retrieve_file_content_not_found(self, files_provider): async def test_retrieve_file_content_not_found(self, files_provider):
"""Test retrieving content of a non-existent file.""" """Test retrieving content of a non-existent file."""
with pytest.raises(ValueError, match="File with id file-nonexistent not found"): with pytest.raises(ResourceNotFoundError, match="not found"):
await files_provider.openai_retrieve_file_content("file-nonexistent") await files_provider.openai_retrieve_file_content("file-nonexistent")
async def test_delete_file_success(self, files_provider, sample_text_file): async def test_delete_file_success(self, files_provider, sample_text_file):
@ -229,12 +230,12 @@ class TestOpenAIFilesAPI:
assert delete_response.deleted is True assert delete_response.deleted is True
# Verify file no longer exists # Verify file no longer exists
with pytest.raises(ValueError, match=f"File with id {uploaded_file.id} not found"): with pytest.raises(ResourceNotFoundError, match="not found"):
await files_provider.openai_retrieve_file(uploaded_file.id) await files_provider.openai_retrieve_file(uploaded_file.id)
async def test_delete_file_not_found(self, files_provider): async def test_delete_file_not_found(self, files_provider):
"""Test deleting a non-existent file.""" """Test deleting a non-existent file."""
with pytest.raises(ValueError, match="File with id file-nonexistent not found"): with pytest.raises(ResourceNotFoundError, match="not found"):
await files_provider.openai_delete_file("file-nonexistent") await files_provider.openai_delete_file("file-nonexistent")
async def test_file_persistence_across_operations(self, files_provider, sample_text_file): async def test_file_persistence_across_operations(self, files_provider, sample_text_file):