コード例 #1
0
    async def test_begin_dialog_options_validation(self):
        dialog_options = SkillDialogOptions()
        sut = SkillDialog(dialog_options, dialog_id="dialog_id")

        # empty options should raise
        client = DialogTestClient("test", sut)
        with self.assertRaises(TypeError):
            await client.send_activity("irrelevant")

        # non DialogArgs should raise
        client = DialogTestClient("test", sut, {})
        with self.assertRaises(TypeError):
            await client.send_activity("irrelevant")

        # Activity in DialogArgs should be set
        client = DialogTestClient("test", sut, BeginSkillDialogOptions(None))
        with self.assertRaises(TypeError):
            await client.send_activity("irrelevant")

        # Only Message and Event activities are supported
        client = DialogTestClient(
            "test",
            sut,
            BeginSkillDialogOptions(
                Activity(type=ActivityTypes.conversation_update)),
        )
        with self.assertRaises(TypeError):
            await client.send_activity("irrelevant")
コード例 #2
0
    async def test_constructor_validation_test(self):
        # missing dialog_id
        with self.assertRaises(TypeError):
            SkillDialog(SkillDialogOptions(), None)

        # missing dialog options
        with self.assertRaises(TypeError):
            SkillDialog(None, "dialog_id")
コード例 #3
0
 def _create_skill_dialog_options(self,
                                  conversation_state: ConversationState,
                                  skill_client: BotFrameworkClient):
     return SkillDialogOptions(
         bot_id=str(uuid.uuid4()),
         skill_host_endpoint="http://test.contoso.com/skill/messages",
         conversation_id_factory=SimpleConversationIdFactory(),
         conversation_state=conversation_state,
         skill_client=skill_client,
         skill=BotFrameworkSkill(
             app_id=str(uuid.uuid4()),
             skill_endpoint="http://testskill.contoso.com/api/messages",
         ),
     )
コード例 #4
0
    async def test_begin_dialog_options_validation(self):
        dialog_options = SkillDialogOptions()
        sut = SkillDialog(dialog_options, dialog_id="dialog_id")

        # empty options should raise
        client = DialogTestClient("test", sut)
        with self.assertRaises(TypeError):
            await client.send_activity("irrelevant")

        # non DialogArgs should raise
        client = DialogTestClient("test", sut, {})
        with self.assertRaises(TypeError):
            await client.send_activity("irrelevant")

        # Activity in DialogArgs should be set
        client = DialogTestClient("test", sut, BeginSkillDialogOptions(None))
        with self.assertRaises(TypeError):
            await client.send_activity("irrelevant")