Skip to content

Commit

Permalink
unittests/skill_self_activation
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Oct 2, 2023
1 parent 2a8d500 commit 596489d
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions test/end2end/session/test_fallback_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,16 @@ def wait_for_n_messages(n):
"mycroft.skill.handler.start",
"enclosure.active_skill",
"speak",
# self activation from skill, instead of from core
"intent.service.skills.activate",
"intent.service.skills.activated",
f"{self.skill_id}.activate",
"ovos.session.update_default", # because it comes from skill
# backwards compat activation for older cores
"active_skill_request",
"intent.service.skills.activated",
f"{self.skill_id}.activate",
"ovos.session.update_default", # because it comes from skill
# report handling
"mycroft.skill.handler.complete",
"mycroft.skills.fallback.response",
Expand Down Expand Up @@ -140,22 +143,24 @@ def wait_for_n_messages(n):
self.assertEqual(messages[16].msg_type, "intent.service.skills.activated")
self.assertEqual(messages[16].data["skill_id"], self.skill_id)
self.assertEqual(messages[17].msg_type, f"{self.skill_id}.activate")
self.assertEqual(messages[18].msg_type, 'ovos.session.update_default')
# skill making itself active again - backwards compat namespace
self.assertEqual(messages[18].msg_type, "active_skill_request")
self.assertEqual(messages[18].data["skill_id"], self.skill_id)
self.assertEqual(messages[19].msg_type, "intent.service.skills.activated")
self.assertEqual(messages[19].msg_type, "active_skill_request")
self.assertEqual(messages[19].data["skill_id"], self.skill_id)
self.assertEqual(messages[20].msg_type, f"{self.skill_id}.activate")
self.assertEqual(messages[20].msg_type, "intent.service.skills.activated")
self.assertEqual(messages[20].data["skill_id"], self.skill_id)
self.assertEqual(messages[21].msg_type, f"{self.skill_id}.activate")
self.assertEqual(messages[22].msg_type, 'ovos.session.update_default')

# fallback execution response
self.assertEqual(messages[21].msg_type, "mycroft.skill.handler.complete")
self.assertEqual(messages[21].data["handler"], "fallback")
self.assertEqual(messages[22].msg_type, "mycroft.skills.fallback.response")
self.assertTrue(messages[22].data["handled"])
self.assertEqual(messages[23].msg_type, "mycroft.skill.handler.complete")
self.assertEqual(messages[23].data["handler"], "fallback")
self.assertEqual(messages[24].msg_type, "mycroft.skills.fallback.response")
self.assertTrue(messages[24].data["handled"])

# verify default session is now updated
self.assertEqual(messages[23].msg_type, "ovos.session.update_default")
self.assertEqual(messages[23].data["session_data"]["session_id"], "default")
self.assertEqual(messages[25].msg_type, "ovos.session.update_default")
self.assertEqual(messages[25].data["session_data"]["session_id"], "default")

# test second message with no session resumes default active skills
messages = []
Expand Down

0 comments on commit 596489d

Please sign in to comment.