8000 correcting none check to check parameter (#1254) · TaffyWrinkle/botbuilder-python@37aa423 · GitHub
[go: up one dir, main page]

Skip to content

Commit 37aa423

Browse files
authored
correcting none check to check parameter (microsoft#1254)
1 parent c3b4916 commit 37aa423

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

libraries/botbuilder-core/botbuilder/core/teams/teams_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ async def send_message_to_teams_channel(
2222
) -> Tuple[ConversationReference, str]:
2323
if not turn_context:
2424
raise ValueError("The turn_context cannot be None")
25-
if not turn_context.activity:
26-
raise ValueError("The turn_context.activity cannot be None")
25+
if not activity:
26+
raise ValueError("The activity cannot be None")
2727
if not teams_channel_id:
2828
raise ValueError("The teams_channel_id cannot be None or empty")
2929

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@
1313

1414

1515
class TestTeamsInfo(aiounittest.AsyncTestCase):
16+
async def test_send_message_to_teams_channels_without_activity(self):
17+
def create_conversation():
18+
pass
19+
20+
adapter = SimpleAdapterWithCreateConversation(
21+
call_create_conversation=create_conversation
22+
)
23+
24+
activity = Activity()
25+
turn_context = TurnContext(adapter, activity)
26+
27+
try:
28+
await TeamsInfo.send_message_to_teams_channel(
29+
turn_context, None, "channelId123"
30+
)
31+
except ValueError:
32+
pass
33+
else:
34+
assert False, "should have raise ValueError"
35+
1636
async def test_send_message_to_teams(self):
1737
def create_conversation():
1838
pass

0 commit comments

Comments
 (0)
0