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
4 changes: 2 additions & 2 deletions libraries/botbuilder-core/botbuilder/core/activity_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@ async def on_installation_update( # pylint: disable=unused-argument
:type turn_context: :class:`botbuilder.core.TurnContext`
:returns: A task that represents the work queued to execute
"""
if turn_context.activity.action == "add":
if turn_context.activity.action in ("add", "add-upgrade"):
return await self.on_installation_update_add(turn_context)
if turn_context.activity.action == "remove":
if turn_context.activity.action in ("remove", "remove-upgrade"):
return await self.on_installation_update_remove(turn_context)
return

Expand Down
34 changes: 33 additions & 1 deletion libraries/botbuilder-core/tests/test_activity_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,23 @@ async def test_on_installation_update_add(self):
assert bot.record[0] == "on_installation_update"
assert bot.record[1] == "on_installation_update_add"

async def test_on_installation_update_add_remove(self):
async def test_on_installation_update_add_upgrade(self):
activity = Activity(
type=ActivityTypes.installation_update, action="add-upgrade"
)

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

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

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

async def test_on_installation_update_remove(self):
activity = Activity(type=ActivityTypes.installation_update, action="remove")

adapter = TestInvokeAdapter()
Expand All @@ -282,6 +298,22 @@ async def test_on_installation_update_add_remove(self):
assert bot.record[0] == "on_installation_update"
assert bot.record[1] == "on_installation_update_remove"

async def test_on_installation_update_remove_upgrade(self):
activity = Activity(
type=ActivityTypes.installation_update, action="remove-upgrade"
)

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

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

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

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

Expand Down