8000 Add EndOfConversationCodes to EndOfConversation activity from Skill (… · itsmokha/botbuilder-python@4822b98 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4822b98

Browse files
authored
Add EndOfConversationCodes to EndOfConversation activity from Skill (microsoft#1402)
1 parent b9678d5 commit 4822b98

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_extensions.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4+
from botframework.connector.auth import (
5+
ClaimsIdentity,
6+
SkillValidation,
7+
AuthenticationConstants,
8+
GovernmentConstants,
9+
)
410
from botbuilder.core import BotAdapter, StatePropertyAccessor, TurnContext
511
from botbuilder.core.skills import SkillHandler, SkillConversationReference
6-
712
from botbuilder.dialogs import (
813
Dialog,
914
DialogEvents,
1015
DialogSet,
1116
DialogTurnStatus,
1217
)
13-
from botbuilder.schema import Activity, ActivityTypes
14-
from botframework.connector.auth import (
15-
ClaimsIdentity,
16-
SkillValidation,
17-
AuthenticationConstants,
18-
GovernmentConstants,
19-
)
18+
from botbuilder.schema import Activity, ActivityTypes, EndOfConversationCodes
2019

2120

2221
class DialogExtensions:
@@ -87,6 +86,9 @@ async def run_dialog(
8786
type=ActivityTypes.end_of_conversation,
8887
value=result.result,
8988
locale=turn_context.activity.locale,
89+
code=EndOfConversationCodes.completed_successfully
90+
if result.status == DialogTurnStatus.Complete
91+
else EndOfConversationCodes.user_cancelled,
9092
)
9193
await turn_context.send_activity(activity)
9294

libraries/botbuilder-dialogs/tests/test_dialogextensions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import aiounittest
99

10+
from botframework.connector.auth import ClaimsIdentity, AuthenticationConstants
1011
from botbuilder.core import (
1112
TurnContext,
1213
MessageFactory,
@@ -28,8 +29,7 @@
2829
TranscriptLoggerMiddleware,
2930
ConsoleTranscriptLogger,
3031
)
31-
from botbuilder.schema import ActivityTypes, Activity
32-
from botframework.connector.auth import ClaimsIdentity, AuthenticationConstants
32+
from botbuilder.schema import ActivityTypes, Activity, EndOfConversationCodes
3333
from botbuilder.dialogs import (
3434
ComponentDialog,
3535
TextPrompt,
@@ -111,6 +111,7 @@ async def handles_bot_and_skills_test_cases(
111111
self.eoc_sent, "Skills should send EndConversation to channel"
112112
)
113113
assert ActivityTypes.end_of_conversation == self.eoc_sent.type
114+
assert EndOfConversationCodes.completed_successfully == self.eoc_sent.code
114115
assert self.eoc_sent.value == "SomeName"
115116
else:
116117
self.assertIsNone(

0 commit comments

Comments
 (0)
0