Repository: microsoft/botbuilder-python (python)

Issue:
channels.py is missing 3 channels
## Version
main

## Describe the bug
[channels.py](https://github.com/microsoft/botbuilder-python/blob/main/libraries/botframework-connector/botframework/connector/channels.py) is missing Direct Line Speech, Test, and Twilio. These should be added for parity with [.NET](https://github.com/microsoft/botbuilder-dotnet/blob/main/libraries/Microsoft.Bot.Connector/Channels.cs) and [Node](https://github.com/microsoft/botbuilder-js/blob/main/libraries/botframework-schema/src/index.ts#L1911-L1939). Once these are added, they should be referenced in the appropriate places like [channel.py](https://github.com/microsoft/botbuilder-python/blob/main/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/channel.py) and [test_adapter.py](https://github.com/microsoft/botbuilder-python/blob/main/libraries/botbuilder-core/botbuilder/core/adapters/test_adapter.py).

Pull request description:
Adding directlinespeech & test channels in channels.py
Fixes #1438

## Description
<!-- Please discuss the changes you have worked on. What do the changes do; why is this PR needed? -->

## Specific Changes
- Adding directlinespeech & test channels in channels.py
- Replacing hardcoded channel names with references from the Channels Enum


Patch:
diff --git a/libraries/botbuilder-adapters-slack/botbuilder/adapters/slack/slack_helper.py b/libraries/botbuilder-adapters-slack/botbuilder/adapters/slack/slack_helper.py
index 35f720c8..c40dd21e 100644
--- a/libraries/botbuilder-adapters-slack/botbuilder/adapters/slack/slack_helper.py
+++ b/libraries/botbuilder-adapters-slack/botbuilder/adapters/slack/slack_helper.py
@@ -15,6 +15,7 @@ from botbuilder.schema import (
     ChannelAccount,
     ActivityTypes,
 )
+from botframework.connector import Channels
 
 from .slack_message import SlackMessage
 from .slack_client import SlackClient
@@ -125,7 +126,7 @@ class SlackHelper:
             raise Exception("payload is required")
 
         activity = Activity(
-            channel_id="slack",
+            channel_id=Channels.slack,
             conversation=ConversationAccount(id=payload.channel["id"], properties={}),
             from_property=ChannelAccount(
                 id=(
@@ -178,7 +179,7 @@ class SlackHelper:
 
         activity = Activity(
             id=event.event_ts,
-            channel_id="slack",
+            channel_id=Channels.slack,
             conversation=ConversationAccount(
                 id=event.channel if event.channel else event.channel_id, properties={}
             ),
@@ -235,7 +236,7 @@ class SlackHelper:
 
         activity = Activity(
             id=body.trigger_id,
-            channel_id="slack",
+            channel_id=Channels.slack,
             conversation=ConversationAccount(id=body.channel_id, properties={}),
             from_property=ChannelAccount(id=body.user_id),
             recipient=ChannelAccount(id=None),
diff --git a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/channel.py b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/channel.py
index cd36ac63..aa19a274 100644
--- a/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/channel.py
+++ b/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/channel.py
@@ -34,6 +34,7 @@ class Channel:
             Channels.telegram: 100,
             Channels.emulator: 100,
             Channels.direct_line: 100,
+            Channels.direct_line_speech: 100,
             Channels.webchat: 100,
         }
         return (
@@ -64,6 +65,7 @@ class Channel:
             Channels.telegram: 100,
             Channels.emulator: 100,
             Channels.direct_line: 100,
+            Channels.direct_line_speech: 100,
             Channels.webchat: 100,
         }
         return (
diff --git a/libraries/botframework-connector/botframework/connector/channels.py b/libraries/botframework-connector/botframework/connector/channels.py
index be59cc5f..569596b9 100644
--- a/libraries/botframework-connector/botframework/connector/channels.py
+++ b/libraries/botframework-connector/botframework/connector/channels.py
@@ -18,6 +18,9 @@ class Channels(str, Enum):
     direct_line = "directline"
     """Direct Line channel."""
 
+    direct_line_speech = "directlinespeech"
+    """Direct Line Speech channel."""
+
     email = "email"
     """Email channel."""
 
@@ -54,5 +57,8 @@ class Channels(str, Enum):
     telegram = "telegram"
     """Telegram channel."""
 
+    test = "test"
+    """Test channel."""
+
     webchat = "webchat"
     """WebChat channel."""


Test patch:
diff --git a/libraries/botbuilder-core/botbuilder/core/adapters/test_adapter.py b/libraries/botbuilder-core/botbuilder/core/adapters/test_adapter.py
index 56f12234..79070d73 100644
--- a/libraries/botbuilder-core/botbuilder/core/adapters/test_adapter.py
+++ b/libraries/botbuilder-core/botbuilder/core/adapters/test_adapter.py
@@ -31,6 +31,7 @@ from botbuilder.schema import (
 from ..bot_adapter import BotAdapter
 from ..turn_context import TurnContext
 from ..oauth.extended_user_token_provider import ExtendedUserTokenProvider
+from botframework.connector import Channels
 
 
 class UserToken:
@@ -121,7 +122,7 @@ class TestAdapter(BotAdapter, ExtendedUserTokenProvider):
             template_or_conversation
             if isinstance(template_or_conversation, Activity)
             else Activity(
-                channel_id="test",
+                channel_id=Channels.test,
                 service_url="https://test.com",
                 from_property=ChannelAccount(id="User1", name="user"),
                 recipient=ChannelAccount(id="bot", name="Bot"),
@@ -308,7 +309,7 @@ class TestAdapter(BotAdapter, ExtendedUserTokenProvider):
         name: str, user: str = "User1", bot: str = "Bot"
     ) -> ConversationReference:
         return ConversationReference(
-            channel_id="test",
+            channel_id=Channels.test,
             service_url="https://test.com",
             conversation=ConversationAccount(
                 is_group=False,
diff --git a/libraries/botbuilder-core/tests/test_bot_framework_adapter.py b/libraries/botbuilder-core/tests/test_bot_framework_adapter.py
index 7e9268ee..ee8faa77 100644
--- a/libraries/botbuilder-core/tests/test_bot_framework_adapter.py
+++ b/libraries/botbuilder-core/tests/test_bot_framework_adapter.py
@@ -27,6 +27,7 @@ from botbuilder.schema import (
     TokenExchangeInvokeRequest,
     TokenExchangeInvokeResponse,
 )
+from botframework.connector import Channels
 from botframework.connector.token_api.models import (
     TokenExchangeRequest,
     TokenResponse as ConnectorTokenResponse,
@@ -44,7 +45,7 @@ from botframework.connector.auth import (
 
 REFERENCE = ConversationReference(
     activity_id="1234",
-    channel_id="test",
+    channel_id=Channels.test,
     locale="en-uS",  # Intentionally oddly-cased to check that it isn't defaulted somewhere, but tests stay in English
     service_url="https://example.org/channel",
     user=ChannelAccount(id="user", name="User Name"),
@@ -305,7 +306,7 @@ class TestBotFrameworkAdapter(aiounittest.AsyncTestCase):
             is_incoming=True,
         )
 
-        incoming.channel_id = "msteams"
+        incoming.channel_id = Channels.ms_teams
         adapter = AdapterUnderTest()
 
         async def aux_func_assert_tenant_id_copied(context):
@@ -501,7 +502,7 @@ class TestBotFrameworkAdapter(aiounittest.AsyncTestCase):
         sut = BotFrameworkAdapter(settings)
         await sut.process_activity_with_identity(
             Activity(
-                channel_id="emulator",
+                channel_id=Channels.emulator,
                 service_url=service_url,
                 text="test",
             ),
@@ -549,7 +550,7 @@ class TestBotFrameworkAdapter(aiounittest.AsyncTestCase):
         sut = BotFrameworkAdapter(settings)
         await sut.process_activity_with_identity(
             Activity(
-                channel_id="emulator",
+                channel_id=Channels.emulator,
                 service_url=service_url,
                 text="test",
             ),
@@ -709,7 +710,7 @@ class TestBotFrameworkAdapter(aiounittest.AsyncTestCase):
 
         inbound_activity = Activity(
             type=ActivityTypes.message,
-            channel_id="emulator",
+            channel_id=Channels.emulator,
             service_url="http://tempuri.org/whatever",
             delivery_mode=DeliveryModes.expect_replies,
             text="hello world",
@@ -754,7 +755,7 @@ class TestBotFrameworkAdapter(aiounittest.AsyncTestCase):
 
         inbound_activity = Activity(
             type=ActivityTypes.message,
-            channel_id="emulator",
+            channel_id=Channels.emulator,
             service_url="http://tempuri.org/whatever",
             delivery_mode=DeliveryModes.normal,
             text="hello world",
diff --git a/libraries/botbuilder-core/tests/test_conversation_state.py b/libraries/botbuilder-core/tests/test_conversation_state.py
index 4c4e74c1..79d90ca5 100644
--- a/libraries/botbuilder-core/tests/test_conversation_state.py
+++ b/libraries/botbuilder-core/tests/test_conversation_state.py
@@ -6,20 +6,25 @@ import aiounittest
 from botbuilder.core import TurnContext, MemoryStorage, ConversationState
 from botbuilder.core.adapters import TestAdapter
 from botbuilder.schema import Activity, ConversationAccount
+from botframework.connector import Channels
 
 RECEIVED_MESSAGE = Activity(
     type="message",
     text="received",
-    channel_id="test",
+    channel_id=Channels.test,
     conversation=ConversationAccount(id="convo"),
 )
 MISSING_CHANNEL_ID = Activity(
     type="message", text="received", conversation=ConversationAccount(id="convo")
 )
-MISSING_CONVERSATION = Activity(type="message", text="received", channel_id="test")
+MISSING_CONVERSATION = Activity(
+    type="message",
+    text="received",
+    channel_id=Channels.test,
+)
 END_OF_CONVERSATION = Activity(
     type="endOfConversation",
-    channel_id="test",
+    channel_id=Channels.test,
     conversation=ConversationAccount(id="convo"),
 )
 
diff --git a/libraries/botbuilder-core/tests/test_memory_transcript_store.py b/libraries/botbuilder-core/tests/test_memory_transcript_store.py
index 14b313c9..f7ace436 100644
--- a/libraries/botbuilder-core/tests/test_memory_transcript_store.py
+++ b/libraries/botbuilder-core/tests/test_memory_transcript_store.py
@@ -25,6 +25,7 @@ from botbuilder.schema import (
     ConversationAccount,
     ConversationReference,
 )
+from botframework.connector import Channels
 
 
 # pylint: disable=line-too-long,missing-docstring
@@ -98,7 +99,7 @@ class TestMemoryTranscriptStore(aiounittest.AsyncTestCase):
                     timestamp=time_stamp,
                     id=str(uuid.uuid4()),
                     text=str(i),
-                    channel_id="test",
+                    channel_id=Channels.test,
                     from_property=ChannelAccount(id=f"User{i}"),
                     conversation=ConversationAccount(id=conversation_id),
                     recipient=ChannelAccount(id="bot1", name="2"),
@@ -112,7 +113,7 @@ class TestMemoryTranscriptStore(aiounittest.AsyncTestCase):
                     timestamp=date,
                     id=str(uuid.uuid4()),
                     text=str(i),
-                    channel_id="test",
+                    channel_id=Channels.test,
                     from_property=ChannelAccount(id="Bot1", name="2"),
                     conversation=ConversationAccount(id=conversation_id),
                     recipient=ChannelAccount(id=f"User{i}"),
diff --git a/libraries/botbuilder-core/tests/test_private_conversation_state.py b/libraries/botbuilder-core/tests/test_private_conversation_state.py
index 802a2678..5fb4507e 100644
--- a/libraries/botbuilder-core/tests/test_private_conversation_state.py
+++ b/libraries/botbuilder-core/tests/test_private_conversation_state.py
@@ -6,11 +6,12 @@ import aiounittest
 from botbuilder.core import MemoryStorage, TurnContext, PrivateConversationState
 from botbuilder.core.adapters import TestAdapter
 from botbuilder.schema import Activity, ChannelAccount, ConversationAccount
+from botframework.connector import Channels
 
 RECEIVED_MESSAGE = Activity(
     text="received",
     type="message",
-    channel_id="test",
+    channel_id=Channels.test,
     conversation=ConversationAccount(id="convo"),
     from_property=ChannelAccount(id="user"),
 )
diff --git a/libraries/botbuilder-core/tests/test_telemetry_middleware.py b/libraries/botbuilder-core/tests/test_telemetry_middleware.py
index ee3504d1..7fdd8310 100644
--- a/libraries/botbuilder-core/tests/test_telemetry_middleware.py
+++ b/libraries/botbuilder-core/tests/test_telemetry_middleware.py
@@ -40,7 +40,7 @@ class TestTelemetryMiddleware(aiounittest.AsyncTestCase):
 
         adapter = TestAdapter(
             template_or_conversation=Activity(
-                channel_id="test",
+                channel_id=Channels.test,
                 recipient=ChannelAccount(id="bot", name="Bot"),
                 conversation=ConversationAccount(id=str(uuid.uuid4())),
             )
diff --git a/libraries/botbuilder-core/tests/test_test_adapter.py b/libraries/botbuilder-core/tests/test_test_adapter.py
index 447f74ea..269a5197 100644
--- a/libraries/botbuilder-core/tests/test_test_adapter.py
+++ b/libraries/botbuilder-core/tests/test_test_adapter.py
@@ -7,6 +7,7 @@ from botframework.connector.auth import MicrosoftAppCredentials
 from botbuilder.core import TurnContext
 from botbuilder.core.adapters import TestAdapter
 from botbuilder.schema import Activity, ConversationReference, ChannelAccount
+from botframework.connector import Channels
 
 RECEIVED_MESSAGE = Activity(type="message", text="received")
 UPDATED_ACTIVITY = Activity(type="message", text="update")
@@ -141,7 +142,7 @@ class TestTestAdapter(aiounittest.AsyncTestCase):
     async def test_get_user_token_returns_null(self):
         adapter = TestAdapter()
         activity = Activity(
-            channel_id="directline", from_property=ChannelAccount(id="testuser")
+            channel_id=Channels.direct_line, from_property=ChannelAccount(id="testuser")
         )
 
         turn_context = TurnContext(adapter, activity)
@@ -158,7 +159,7 @@ class TestTestAdapter(aiounittest.AsyncTestCase):
     async def test_get_user_token_returns_null_with_code(self):
         adapter = TestAdapter()
         activity = Activity(
-            channel_id="directline", from_property=ChannelAccount(id="testuser")
+            channel_id=Channels.direct_line, from_property=ChannelAccount(id="testuser")
         )
 
         turn_context = TurnContext(adapter, activity)
@@ -180,7 +181,7 @@ class TestTestAdapter(aiounittest.AsyncTestCase):
     async def test_get_user_token_returns_token(self):
         adapter = TestAdapter()
         connection_name = "myConnection"
-        channel_id = "directline"
+        channel_id = Channels.direct_line
         user_id = "testUser"
         token = "abc123"
         activity = Activity(
@@ -207,7 +208,7 @@ class TestTestAdapter(aiounittest.AsyncTestCase):
     async def test_get_user_token_returns_token_with_magice_code(self):
         adapter = TestAdapter()
         connection_name = "myConnection"
-        channel_id = "directline"
+        channel_id = Channels.direct_line
         user_id = "testUser"
         token = "abc123"
         magic_code = "888999"
diff --git a/libraries/botbuilder-core/tests/test_user_state.py b/libraries/botbuilder-core/tests/test_user_state.py
index a39ee107..9f7e2267 100644
--- a/libraries/botbuilder-core/tests/test_user_state.py
+++ b/libraries/botbuilder-core/tests/test_user_state.py
@@ -6,17 +6,20 @@ import aiounittest
 from botbuilder.core import TurnContext, MemoryStorage, UserState
 from botbuilder.core.adapters import TestAdapter
 from botbuilder.schema import Activity, ChannelAccount
+from botframework.connector import Channels
 
 RECEIVED_MESSAGE = Activity(
     type="message",
     text="received",
-    channel_id="test",
+    channel_id=Channels.test,
     from_property=ChannelAccount(id="user"),
 )
 MISSING_CHANNEL_ID = Activity(
     type="message", text="received", from_property=ChannelAccount(id="user")
 )
-MISSING_FROM_PROPERTY = Activity(type="message", text="received", channel_id="test")
+MISSING_FROM_PROPERTY = Activity(
+    type="message", text="received", channel_id=Channels.test
+)
 
 
 class TestUserState(aiounittest.AsyncTestCase):
diff --git a/libraries/botbuilder-dialogs/tests/choices/test_channel.py b/libraries/botbuilder-dialogs/tests/choices/test_channel.py
index 269aaae1..23d26ac4 100644
--- a/libraries/botbuilder-dialogs/tests/choices/test_channel.py
+++ b/libraries/botbuilder-dialogs/tests/choices/test_channel.py
@@ -25,6 +25,7 @@ class ChannelTest(unittest.TestCase):
             (Channels.kik, 21, False),
             (Channels.emulator, 100, True),
             (Channels.emulator, 101, False),
+            (Channels.direct_line_speech, 100, True),
         ]
 
         for channel, button_cnt, expected in supports_suggested_actions_data:
@@ -41,6 +42,7 @@ class ChannelTest(unittest.TestCase):
             (Channels.slack, 100, True),
             (Channels.skype, 3, True),
             (Channels.skype, 5, False),
+            (Channels.direct_line_speech, 99, True),
         ]
 
         for channel, button_cnt, expected in supports_card_action_data:
diff --git a/libraries/botbuilder-dialogs/tests/memory/scopes/test_memory_scopes.py b/libraries/botbuilder-dialogs/tests/memory/scopes/test_memory_scopes.py
index 5101c707..d7b30535 100644
--- a/libraries/botbuilder-dialogs/tests/memory/scopes/test_memory_scopes.py
+++ b/libraries/botbuilder-dialogs/tests/memory/scopes/test_memory_scopes.py
@@ -32,6 +32,7 @@ from botbuilder.schema import (
     ChannelAccount,
     ConversationAccount,
 )
+from botframework.connector import Channels
 
 
 class TestDialog(Dialog):
@@ -92,7 +93,7 @@ class MemoryScopesTests(aiounittest.AsyncTestCase):
     begin_message = Activity(
         text="begin",
         type=ActivityTypes.message,
-        channel_id="test",
+        channel_id=Channels.test,
         from_property=ChannelAccount(id="user"),
         recipient=ChannelAccount(id="bot"),
         conversation=ConversationAccount(id="convo1"),
diff --git a/libraries/botbuilder-dialogs/tests/test_dialog_manager.py b/libraries/botbuilder-dialogs/tests/test_dialog_manager.py
index 57b264e6..3c5a4b34 100644
--- a/libraries/botbuilder-dialogs/tests/test_dialog_manager.py
+++ b/libraries/botbuilder-dialogs/tests/test_dialog_manager.py
@@ -42,6 +42,7 @@ from botbuilder.schema import (
     InputHints,
 )
 from botframework.connector.auth import AuthenticationConstants, ClaimsIdentity
+from botframework.connector import Channels
 
 
 class SkillFlowTestCase(str, Enum):
@@ -103,7 +104,7 @@ class SimpleComponentDialog(ComponentDialog):
         user_state = UserState(storage)
 
         activity = Activity(
-            channel_id="test",
+            channel_id=Channels.test,
             service_url="https://test.com",
             from_property=ChannelAccount(id="user1", name="User1"),
             recipient=ChannelAccount(id="bot", name="Bot"),
diff --git a/libraries/botframework-connector/tests/test_attachments.py b/libraries/botframework-connector/tests/test_attachments.py
index bd280c84..b6d17125 100644
--- a/libraries/botframework-connector/tests/test_attachments.py
+++ b/libraries/botframework-connector/tests/test_attachments.py
@@ -8,13 +8,13 @@ import pytest
 
 import msrest
 from botbuilder.schema import AttachmentData, ErrorResponseException
-from botframework.connector import ConnectorClient
+from botframework.connector import ConnectorClient, Channels
 from botframework.connector.auth import MicrosoftAppCredentials
 
 from authentication_stub import MicrosoftTokenAuthenticationStub
 
 SERVICE_URL = "https://slack.botframework.com"
-CHANNEL_ID = "slack"
+CHANNEL_ID = Channels.slack
 BOT_NAME = "botbuilder-pc-bot"
 BOT_ID = "B21UTEF8S:T03CWQ0QB"
 RECIPIENT_ID = "U19KH8EHJ:T03CWQ0QB"
diff --git a/libraries/botframework-connector/tests/test_attachments_async.py b/libraries/botframework-connector/tests/test_attachments_async.py
index c0f7c945..fe043418 100644
--- a/libraries/botframework-connector/tests/test_attachments_async.py
+++ b/libraries/botframework-connector/tests/test_attachments_async.py
@@ -12,9 +12,10 @@ from botframework.connector.aio import ConnectorClient
 from botframework.connector.auth import MicrosoftAppCredentials
 
 from authentication_stub import MicrosoftTokenAuthenticationStub
+from botframework.connector import Channels
 
 SERVICE_URL = "https://slack.botframework.com"
-CHANNEL_ID = "slack"
+CHANNEL_ID = Channels.slack
 BOT_NAME = "botbuilder-pc-bot"
 BOT_ID = "B21UTEF8S:T03CWQ0QB"
 RECIPIENT_ID = "U19KH8EHJ:T03CWQ0QB"
diff --git a/libraries/botframework-connector/tests/test_conversations.py b/libraries/botframework-connector/tests/test_conversations.py
index c6492664..ea94a247 100644
--- a/libraries/botframework-connector/tests/test_conversations.py
+++ b/libraries/botframework-connector/tests/test_conversations.py
@@ -15,13 +15,13 @@ from botbuilder.schema import (
     ErrorResponseException,
     HeroCard,
 )
-from botframework.connector import ConnectorClient
+from botframework.connector import ConnectorClient, Channels
 from botframework.connector.auth import MicrosoftAppCredentials
 
 from authentication_stub import MicrosoftTokenAuthenticationStub
 
 SERVICE_URL = "https://slack.botframework.com"
-CHANNEL_ID = "slack"
+CHANNEL_ID = Channels.slack
 BOT_NAME = "botbuilder-pc-bot"
 BOT_ID = "B21UTEF8S:T03CWQ0QB"
 RECIPIENT_ID = "U19KH8EHJ:T03CWQ0QB"
diff --git a/libraries/botframework-connector/tests/test_conversations_async.py b/libraries/botframework-connector/tests/test_conversations_async.py
index 074247c8..5e0c8fcc 100644
--- a/libraries/botframework-connector/tests/test_conversations_async.py
+++ b/libraries/botframework-connector/tests/test_conversations_async.py
@@ -19,9 +19,10 @@ from botframework.connector.aio import ConnectorClient
 from botframework.connector.auth import MicrosoftAppCredentials
 
 from authentication_stub import MicrosoftTokenAuthenticationStub
+from botframework.connector import Channels
 
 SERVICE_URL = "https://slack.botframework.com"
-CHANNEL_ID = "slack"
+CHANNEL_ID = Channels.slack
 BOT_NAME = "botbuilder-pc-bot"
 BOT_ID = "B21UTEF8S:T03CWQ0QB"
 RECIPIENT_ID = "U19KH8EHJ:T03CWQ0QB"