def test_teams_helper_teams_schema(self): # Arrange data = { "data": { "key": "value" }, "context": { "theme": "dark" }, "commandId": "test_command", "commandContext": "command_context_test", "botMessagePreviewAction": "edit", "botActivityPreview": [{ "id": "activity123" }], "messagePayload": { "id": "payloadid" }, } # Act result = deserializer_helper(MessagingExtensionAction, data) # Assert assert result.data == {"key": "value"} assert result.context == TaskModuleRequestContext(theme="dark") assert result.command_id == "test_command" assert result.bot_message_preview_action == "edit" assert len(result.bot_activity_preview) == 1 assert result.bot_activity_preview[0] == Activity(id="activity123") assert result.message_payload == MessageActionsPayload(id="payloadid")
async def test_on_teams_task_module_submit(self): # Arrange activity = Activity( type=ActivityTypes.invoke, name="task/submit", value={ "data": {"key": "value"}, "context": TaskModuleRequestContext().serialize(), }, ) turn_context = TurnContext(SimpleAdapter(), activity) # Act bot = TestingTeamsActivityHandler() await bot.on_turn(turn_context) # Assert assert len(bot.record) == 2 assert bot.record[0] == "on_invoke_activity" assert bot.record[1] == "on_teams_task_module_submit"