66
77from botbuilder .core import TurnContext , MessageFactory
88from botbuilder .core .teams import TeamsInfo , TeamsActivityHandler
9- from botbuilder .schema import Activity , ChannelAccount , ConversationAccount , ConversationReference
10- from botbuilder .schema .teams import TeamsChannelData , TeamInfo
11- from botframework .connector import Channels
9+ from botbuilder .schema import (
10+ Activity ,
11+ ChannelAccount ,
12+ ConversationAccount ,
13+ )
1214from simple_adapter_with_create_conversation import SimpleAdapterWithCreateConversation
13- from typing import Tuple
1415
1516ACTIVITY = Activity (
1617 id = "1234" ,
2526 service_url = "https://example.org" ,
2627)
2728
29+
2830class TestTeamsInfo (aiounittest .AsyncTestCase ):
2931 async def test_send_message_to_teams_channels_without_activity (self ):
3032 def create_conversation ():
@@ -60,12 +62,14 @@ def create_conversation():
6062
6163 async def test_send_message_to_teams_channels_without_turn_context (self ):
6264 try :
63- await TeamsInfo .send_message_to_teams_channel (None , ACTIVITY , "channelId123" )
65+ await TeamsInfo .send_message_to_teams_channel (
66+ None , ACTIVITY , "channelId123"
67+ )
6468 except ValueError :
6569 pass
6670 else :
6771 assert False , "should have raise ValueError"
68-
72+
6973 async def test_send_message_to_teams_channels_without_teams_channel_id (self ):
7074 def create_conversation ():
7175 pass
@@ -100,11 +104,13 @@ def create_conversation():
100104 else :
101105 assert False , "should have raise ValueError"
102106
103- async def test_send_message_to_teams_channel_works (self ):
107+ async def test_send_message_to_teams_channel_works (self ):
104108 adapter = SimpleAdapterWithCreateConversation ()
105109
106110 turn_context = TurnContext (adapter , ACTIVITY )
107- result = await TeamsInfo .send_message_to_teams_channel (turn_context , ACTIVITY , "teamId123" )
111+ result = await TeamsInfo .send_message_to_teams_channel (
112+ turn_context , ACTIVITY , "teamId123"
113+ )
108114 assert result [0 ].activity_id == "new_conversation_id"
109115 assert result [1 ] == "reference123"
110116
@@ -115,17 +121,16 @@ async def test_get_team_details_works_without_team_id(self):
115121 result = TeamsInfo .get_team_id (turn_context )
116122
117123 assert result == ""
118-
124+
119125 async def test_get_team_details_works_with_team_id (self ):
120126 adapter = SimpleAdapterWithCreateConversation ()
121127 team_id = "teamId123"
122- ACTIVITY .channel_data = {"team" :{"id" : team_id }}
128+ ACTIVITY .channel_data = {"team" : {"id" : team_id }}
123129 turn_context = TurnContext (adapter , ACTIVITY )
124130 result = TeamsInfo .get_team_id (turn_context )
125131
126132 assert result == team_id
127133
128-
129134 async def test_get_team_details_without_team_id (self ):
130135 def create_conversation ():
131136 pass
@@ -142,7 +147,7 @@ def create_conversation():
142147 pass
143148 else :
144149 assert False , "should have raise TypeError"
145-
150+
146151 async def test_get_team_channels_without_team_id (self ):
147152 def create_conversation ():
148153 pass
@@ -176,7 +181,7 @@ def create_conversation():
176181 pass
177182 else :
178183 assert False , "should have raise TypeError"
179-
184+
180185 async def test_get_team_members_without_team_id (self ):
181186 def create_conversation ():
182187 pass
@@ -193,7 +198,7 @@ def create_conversation():
193198 pass
194199 else :
195200 assert False , "should have raise TypeError"
196-
201+
197202 async def test_get_team_members_without_member_id (self ):
198203 def create_conversation ():
199204 pass
@@ -210,8 +215,8 @@ def create_conversation():
210215 pass
211216 else :
212217 assert False , "should have raise TypeError"
213-
214-
218+
219+
215220class TestTeamsActivityHandler (TeamsActivityHandler ):
216221 async def on_turn (self , turn_context : TurnContext ):
217222 await super ().on_turn (turn_context )
0 commit comments