async def test_get_team_details_works_without_team_id(self): adapter = SimpleAdapterWithCreateConversation() ACTIVITY.channel_data = {} turn_context = TurnContext(adapter, ACTIVITY) result = TeamsInfo.get_team_id(turn_context) assert result == ""
async def test_send_message_to_teams_channel_works(self): adapter = SimpleAdapterWithCreateConversation() turn_context = TurnContext(adapter, ACTIVITY) result = await TeamsInfo.send_message_to_teams_channel( turn_context, ACTIVITY, "teamId123") assert result[0].activity_id == "new_conversation_id" assert result[1] == "reference123"
async def test_get_team_details_works_with_team_id(self): adapter = SimpleAdapterWithCreateConversation() team_id = "teamId123" ACTIVITY.channel_data = {"team": {"id": team_id}} turn_context = TurnContext(adapter, ACTIVITY) result = TeamsInfo.get_team_id(turn_context) assert result == team_id
async def test_send_message_to_teams(self): def create_conversation(): pass adapter = SimpleAdapterWithCreateConversation( call_create_conversation=create_conversation) turn_context = TurnContext(adapter, ACTIVITY) handler = TestTeamsActivityHandler() await handler.on_turn(turn_context)
async def test_get_team_members_without_member_id(self): def create_conversation(): pass adapter = SimpleAdapterWithCreateConversation( call_create_conversation=create_conversation) turn_context = TurnContext(adapter, ACTIVITY) try: await TeamsInfo.get_team_member(turn_context, "teamId123") except TypeError: pass else: assert False, "should have raise TypeError"
async def test_send_message_to_teams_channels_without_teams_channel_id(self): def create_conversation(): pass adapter = SimpleAdapterWithCreateConversation( call_create_conversation=create_conversation ) turn_context = TurnContext(adapter, ACTIVITY) try: await TeamsInfo.send_message_to_teams_channel(turn_context, ACTIVITY, "") except ValueError: pass else: assert False, "should have raise ValueError"
async def test_send_message_to_teams_channels_without_activity(self): def create_conversation(): pass adapter = SimpleAdapterWithCreateConversation( call_create_conversation=create_conversation) activity = Activity() turn_context = TurnContext(adapter, activity) try: await TeamsInfo.send_message_to_teams_channel( turn_context, None, "channelId123") except ValueError: pass else: assert False, "should have raise ValueError"
async def test_send_message_to_teams(self): def create_conversation(): pass adapter = SimpleAdapterWithCreateConversation( call_create_conversation=create_conversation) activity = Activity( type="message", text="test_send_message_to_teams_channel", channel_id=Channels.ms_teams, service_url="https://example.org", channel_data=TeamsChannelData(team=TeamInfo(id="team-id")), ) turn_context = TurnContext(adapter, activity) handler = TestTeamsActivityHandler() await handler.on_turn(turn_context)
async def test_get_meeting_info(self): adapter = SimpleAdapterWithCreateConversation() activity = Activity( type="message", text="Test-get_meeting_info", channel_id=Channels.ms_teams, from_property=ChannelAccount(aad_object_id="participantId-1"), channel_data={"meeting": { "id": "meetingId-1" }}, service_url="https://test.coffee", ) turn_context = TurnContext(adapter, activity) handler = TeamsActivityHandler() await handler.on_turn(turn_context)