fix: unit tests fixes and ruff formating

N25B-205
This commit is contained in:
Björn Otgaar
2025-10-28 11:31:05 +01:00
parent 52faa59184
commit 47a87d0b4a
11 changed files with 307 additions and 209 deletions

View File

@@ -6,6 +6,7 @@ from unittest.mock import MagicMock
from control_backend.api.v1.endpoints import command
from control_backend.schemas.ri_message import SpeechCommand
@pytest.fixture
def app():
"""
@@ -49,7 +50,7 @@ def test_receive_command_endpoint(client, app):
assert sent_data[0] == b"command"
# Check JSON encoding roughly matches
assert isinstance(sent_data[1], SpeechCommand)
assert isinstance(SpeechCommand.model_validate_json(sent_data[1].decode()), SpeechCommand)
def test_receive_command_invalid_payload(client):
@@ -59,4 +60,4 @@ def test_receive_command_invalid_payload(client):
# Missing required field(s)
bad_payload = {"invalid": "data"}
response = client.post("/command", json=bad_payload)
assert response.status_code == 422 # validation error
assert response.status_code == 422 # validation error