Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions libraries/botbuilder-core/botbuilder/core/activity_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ async def on_turn(self, turn_context: TurnContext):
await self.on_end_of_conversation_activity(turn_context)
elif turn_context.activity.type == ActivityTypes.typing:
await self.on_typing_activity(turn_context)
elif turn_context.activity.type == ActivityTypes.installation_update:
await self.on_installation_update(turn_context)
else:
await self.on_unrecognized_activity_type(turn_context)

Expand Down Expand Up @@ -365,6 +367,19 @@ async def on_typing_activity( # pylint: disable=unused-argument
"""
return

async def on_installation_update( # pylint: disable=unused-argument
self, turn_context: TurnContext
):
"""
Override this in a derived class to provide logic specific to
ActivityTypes.InstallationUpdate activities.

:param turn_context: The context object for this turn
:type turn_context: :class:`botbuilder.core.TurnContext`
:returns: A task that represents the work queued to execute
"""
return

async def on_unrecognized_activity_type( # pylint: disable=unused-argument
self, turn_context: TurnContext
):
Expand Down
17 changes: 17 additions & 0 deletions libraries/botbuilder-core/tests/test_activity_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ async def on_typing_activity(self, turn_context: TurnContext):
self.record.append("on_typing_activity")
return await super().on_typing_activity(turn_context)

async def on_installation_update(self, turn_context: TurnContext):
self.record.append("on_installation_update")
return await super().on_installation_update(turn_context)

async def on_unrecognized_activity_type(self, turn_context: TurnContext):
self.record.append("on_unrecognized_activity_type")
return await super().on_unrecognized_activity_type(turn_context)
Expand Down Expand Up @@ -229,6 +233,19 @@ async def test_typing_activity(self):
assert len(bot.record) == 1
assert bot.record[0] == "on_typing_activity"

async def test_on_installation_update(self):
activity = Activity(type=ActivityTypes.installation_update)

adapter = TestInvokeAdapter()
turn_context = TurnContext(adapter, activity)

# Act
bot = TestingActivityHandler()
await bot.on_turn(turn_context)

assert len(bot.record) == 1
assert bot.record[0] == "on_installation_update"

async def test_healthcheck(self):
activity = Activity(type=ActivityTypes.invoke, name="healthcheck",)

Expand Down