async def test_end_of_conversation_from_expect_replies_calls_delete_conversation_reference( self, ): activity_sent: Activity = None # Callback to capture the parameters sent to the skill async def capture_action( from_bot_id: str, # pylint: disable=unused-argument to_bot_id: str, # pylint: disable=unused-argument to_uri: str, # pylint: disable=unused-argument service_url: str, # pylint: disable=unused-argument conversation_id: str, # pylint: disable=unused-argument activity: Activity, ): # Capture values sent to the skill so we can assert the right parameters were used. nonlocal activity_sent activity_sent = activity eoc = Activity.create_end_of_conversation_activity() expected_replies = list([eoc]) # Create a mock skill client to intercept calls and capture what is sent. mock_skill_client = self._create_mock_skill_client( capture_action, expected_replies=expected_replies ) # Use Memory for conversation state conversation_state = ConversationState(MemoryStorage()) dialog_options = self.create_skill_dialog_options( conversation_state, mock_skill_client ) # Create the SkillDialogInstance and the activity to send. sut = SkillDialog(dialog_options, dialog_id="dialog") activity_to_send = Activity.create_message_activity() activity_to_send.delivery_mode = DeliveryModes.expect_replies activity_to_send.text = str(uuid.uuid4()) client = DialogTestClient( "test", sut, BeginSkillDialogOptions(activity_to_send), conversation_state=conversation_state, ) # Send something to the dialog to start it await client.send_activity("hello") simple_id_factory: SimpleConversationIdFactory = dialog_options.conversation_id_factory self.assertEqual(0, len(simple_id_factory.conversation_refs)) self.assertEqual(1, simple_id_factory.create_count)
def test_create_end_of_conversation_activity(self): # Act result = Activity.create_end_of_conversation_activity() # Assert self.assertEqual(result.type, ActivityTypes.end_of_conversation)