From 66edd17496d58b8bd292fb737a69c38683236ac0 Mon Sep 17 00:00:00 2001 From: Tawakalt Date: Fri, 9 Feb 2024 16:20:19 +0100 Subject: [PATCH] implement PR feedback --- tests/test_endpoint.py | 11 +++++++++++ .../instrumentation/test_validation_action.py | 13 +++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/test_endpoint.py b/tests/test_endpoint.py index 6e7d0d465..29678d3a9 100644 --- a/tests/test_endpoint.py +++ b/tests/test_endpoint.py @@ -25,6 +25,17 @@ def test_server_list_actions_returns_200(): assert response.status == 200 assert len(response.json) == 4 + # ENSURE TO UPDATE AS MORE ACTIONS ARE ADDED IN OTHER TESTS + expected = [ + # defined in tests/test_actions.py + {"name": "custom_async_action"}, + {"name": "custom_action"}, + {"name": "custom_action_exception"}, + # defined in tests/tracing/instrumentation/conftest.py + {"name": "mock_validation_action"}, + ] + assert response.json == expected + def test_server_webhook_unknown_action_returns_404(): data = { diff --git a/tests/tracing/instrumentation/test_validation_action.py b/tests/tracing/instrumentation/test_validation_action.py index 5f745dd06..ce407d8db 100644 --- a/tests/tracing/instrumentation/test_validation_action.py +++ b/tests/tracing/instrumentation/test_validation_action.py @@ -1,17 +1,14 @@ -from typing import Sequence, Optional +from typing import List, Sequence import pytest from opentelemetry.sdk.trace import ReadableSpan, TracerProvider from opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporter from rasa_sdk.tracing.instrumentation import instrumentation -from tests.tracing.instrumentation.conftest import ( - MockValidationAction, - # MockValidationActionSubClass, -) +from tests.tracing.instrumentation.conftest import MockValidationAction from rasa_sdk import Tracker from rasa_sdk.executor import CollectingDispatcher -from rasa_sdk.events import SlotSet +from rasa_sdk.events import SlotSet, EventType @pytest.mark.parametrize( @@ -29,8 +26,8 @@ async def test_tracing_action_executor_run( tracer_provider: TracerProvider, span_exporter: InMemorySpanExporter, previous_num_captured_spans: int, - events: Optional[str], - expected_slots_to_validate: Optional[str], + events: List[EventType], + expected_slots_to_validate: str, ) -> None: component_class = MockValidationAction