Skip to content

Commit cf5566f

Browse files
committed
saving tests so far
1 parent 6861169 commit cf5566f

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

libraries/botbuilder-core/tests/teams/test_teams_info.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,64 @@ def create_conversation():
5252
handler = TestTeamsActivityHandler()
5353
await handler.on_turn(turn_context)
5454

55+
async def test_send_message_to_teams_channels_without_turn_context(self):
56+
activity = Activity(
57+
type="message",
58+
text="test_send_message_to_teams_channel",
59+
channel_id=Channels.ms_teams,
60+
service_url="https://example.org",
61+
channel_data=TeamsChannelData(team=TeamInfo(id="team-id")),
62+
)
63+
64+
try:
65+
await TeamsInfo.send_message_to_teams_channel(None, activity, "channelId123")
66+
except ValueError:
67+
pass
68+
else:
69+
assert False, "should have raise ValueError"
70+
71+
async def test_send_message_to_teams_channels_without_teams_channel_id(self):
72+
def create_conversation():
73+
pass
74+
75+
adapter = SimpleAdapterWithCreateConversation(
76+
call_create_conversation=create_conversation
77+
)
78+
79+
activity = Activity(
80+
type="message",
81+
text="test_send_message_to_teams_channel",
82+
channel_id=Channels.ms_teams,
83+
service_url="https://example.org",
84+
channel_data=TeamsChannelData(team=TeamInfo(id="team-id")),
85+
)
86+
turn_context = TurnContext(adapter, activity)
87+
88+
try:
89+
await TeamsInfo.send_message_to_teams_channel(turn_context, activity, "")
90+
except ValueError:
91+
pass
92+
else:
93+
assert False, "should have raise ValueError"
94+
95+
async def test_send_message_to_teams_channels_without_activity(self):
96+
def create_conversation():
97+
pass
98+
99+
adapter = SimpleAdapterWithCreateConversation(
100+
call_create_conversation=create_conversation
101+
)
102+
103+
activity = Activity()
104+
turn_context = TurnContext(adapter, activity)
105+
106+
try:
107+
await TeamsInfo.send_message_to_teams_channel(turn_context, activity, "")
108+
except ValueError:
109+
pass
110+
else:
111+
assert False, "should have raise ValueError"
112+
55113

56114
class TestTeamsActivityHandler(TeamsActivityHandler):
57115
async def on_turn(self, turn_context: TurnContext):

0 commit comments

Comments
 (0)