From 3949b98bf3456df47fbb53274c845909fa25d454 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Mon, 8 Sep 2025 18:36:44 +0200 Subject: [PATCH 1/2] LCORE-641: authorized response unit tests update --- tests/unit/models/responses/test_authorized_response.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/models/responses/test_authorized_response.py b/tests/unit/models/responses/test_authorized_response.py index f3412462..378157f7 100644 --- a/tests/unit/models/responses/test_authorized_response.py +++ b/tests/unit/models/responses/test_authorized_response.py @@ -15,10 +15,11 @@ def test_constructor(self) -> None: ar = AuthorizedResponse( user_id="123e4567-e89b-12d3-a456-426614174000", username="testuser", - skip_userid_check=False, + skip_userid_check=True, ) assert ar.user_id == "123e4567-e89b-12d3-a456-426614174000" assert ar.username == "testuser" + assert ar.skip_userid_check is True def test_constructor_fields_required(self) -> None: """Test the AuthorizedResponse constructor.""" From 39e0d880aca7f5d1be1bcf15506610a5f3c7b1e2 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Mon, 8 Sep 2025 18:37:01 +0200 Subject: [PATCH 2/2] Deleted unused unit test source file --- tests/unit/models/test_responses.py | 88 ----------------------------- 1 file changed, 88 deletions(-) delete mode 100644 tests/unit/models/test_responses.py diff --git a/tests/unit/models/test_responses.py b/tests/unit/models/test_responses.py deleted file mode 100644 index 42ca4bea..00000000 --- a/tests/unit/models/test_responses.py +++ /dev/null @@ -1,88 +0,0 @@ -"""Tests for QueryResponse. StatusResponse, AuthorizedResponse, and UnauthorizedResponse models.""" - -import pytest - -from pydantic import ValidationError - -from models.responses import ( - QueryResponse, - StatusResponse, - AuthorizedResponse, - UnauthorizedResponse, -) - - -class TestQueryResponse: - """Test cases for the QueryResponse model.""" - - def test_constructor(self) -> None: - """Test the QueryResponse constructor.""" - qr = QueryResponse( - conversation_id="123e4567-e89b-12d3-a456-426614174000", - response="LLM answer", - ) - assert qr.conversation_id == "123e4567-e89b-12d3-a456-426614174000" - assert qr.response == "LLM answer" - - def test_optional_conversation_id(self) -> None: - """Test the QueryResponse with default conversation ID.""" - qr = QueryResponse(response="LLM answer") - assert qr.conversation_id is None - assert qr.response == "LLM answer" - - -class TestStatusResponse: - """Test cases for the StatusResponse model.""" - - def test_constructor_feedback_enabled(self) -> None: - """Test the StatusResponse constructor.""" - sr = StatusResponse(functionality="feedback", status={"enabled": True}) - assert sr.functionality == "feedback" - assert sr.status == {"enabled": True} - - def test_constructor_feedback_disabled(self) -> None: - """Test the StatusResponse constructor.""" - sr = StatusResponse(functionality="feedback", status={"enabled": False}) - assert sr.functionality == "feedback" - assert sr.status == {"enabled": False} - - -class TestAuthorizedResponse: - """Test cases for the AuthorizedResponse model.""" - - def test_constructor(self) -> None: - """Test the AuthorizedResponse constructor.""" - ar = AuthorizedResponse( - user_id="123e4567-e89b-12d3-a456-426614174000", - username="testuser", - skip_userid_check=True, - ) - assert ar.user_id == "123e4567-e89b-12d3-a456-426614174000" - assert ar.username == "testuser" - assert ar.skip_userid_check is True - - def test_constructor_fields_required(self) -> None: - """Test the AuthorizedResponse constructor.""" - with pytest.raises(ValidationError): - AuthorizedResponse(username="testuser") # pyright: ignore - - with pytest.raises(ValidationError): - AuthorizedResponse( - user_id="123e4567-e89b-12d3-a456-426614174000" - ) # pyright: ignore - - -class TestUnauthorizedResponse: - """Test cases for the UnauthorizedResponse model.""" - - def test_constructor(self) -> None: - """Test the UnauthorizedResponse constructor.""" - ur = UnauthorizedResponse( - detail="Missing or invalid credentials provided by client" - ) - assert ur.detail == "Missing or invalid credentials provided by client" - - def test_constructor_fields_required(self) -> None: - """Test the UnauthorizedResponse constructor.""" - with pytest.raises(Exception): - UnauthorizedResponse() # pyright: ignore