tests(genesys): fix formatting

This commit is contained in:
Aleix Conchillo Flaqué
2026-01-28 09:15:42 -08:00
parent 01bbf61e0d
commit 55dadc9118
3 changed files with 77 additions and 73 deletions

View File

@@ -1,6 +1 @@
# Copyright (c) 2026, Daily
#
# SPDX-License-Identifier: BSD 2-Clause License
#
"""Tests for Genesys AudioHook serializer."""

View File

@@ -1,3 +1,9 @@
#
# Copyright (c) 2024-2026, Daily
#
# SPDX-License-Identifier: BSD 2-Clause License
#
"""Pytest fixtures for Genesys AudioHook serializer tests. """Pytest fixtures for Genesys AudioHook serializer tests.
These fixtures provide sample AudioHook protocol messages for testing These fixtures provide sample AudioHook protocol messages for testing

View File

@@ -1,3 +1,9 @@
#
# Copyright (c) 2024-2026, Daily
#
# SPDX-License-Identifier: BSD 2-Clause License
#
"""Tests for the Genesys AudioHook serializer.""" """Tests for the Genesys AudioHook serializer."""
import json import json
@@ -91,7 +97,7 @@ class TestGenesysAudioHookSerializer:
output_variables={ output_variables={
"intent": "billing_inquiry", "intent": "billing_inquiry",
"customer_verified": True, "customer_verified": True,
"summary": "Customer asked about their bill" "summary": "Customer asked about their bill",
} }
) )
@@ -195,7 +201,9 @@ class TestGenesysAudioHookSerializer:
assert result.message["parameters"]["startPaused"] is True assert result.message["parameters"]["startPaused"] is True
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_handle_open_message_extracts_input_variables(self, sample_open_message_with_input_variables): async def test_handle_open_message_extracts_input_variables(
self, sample_open_message_with_input_variables
):
"""Test that open message extracts inputVariables from Genesys.""" """Test that open message extracts inputVariables from Genesys."""
serializer = GenesysAudioHookSerializer() serializer = GenesysAudioHookSerializer()
@@ -236,11 +244,9 @@ class TestGenesysAudioHookSerializer:
serializer._is_open = True serializer._is_open = True
# Set output variables before close # Set output variables before close
serializer.set_output_variables({ serializer.set_output_variables(
"intent": "support", {"intent": "support", "resolved": True, "transfer_to": "agent_queue"}
"resolved": True, )
"transfer_to": "agent_queue"
})
result = await serializer.deserialize(json.dumps(sample_close_message)) result = await serializer.deserialize(json.dumps(sample_close_message))
@@ -258,10 +264,7 @@ class TestGenesysAudioHookSerializer:
assert serializer.output_variables is None assert serializer.output_variables is None
serializer.set_output_variables({ serializer.set_output_variables({"intent": "billing", "score": 0.95})
"intent": "billing",
"score": 0.95
})
assert serializer.output_variables is not None assert serializer.output_variables is not None
assert serializer.output_variables["intent"] == "billing" assert serializer.output_variables["intent"] == "billing"