def test_should_include_choice_actions_in_suggested_actions(self): expected = Activity( type=ActivityTypes.message, text="select from:", input_hint=InputHints.expecting_input, suggested_actions=SuggestedActions(actions=[ CardAction( type=ActionTypes.im_back, value="ImBack Value", title="ImBack Action", ), CardAction( type=ActionTypes.message_back, value="MessageBack Value", title="MessageBack Action", ), CardAction( type=ActionTypes.post_back, value="PostBack Value", title="PostBack Action", ), ]), ) activity = ChoiceFactory.suggested_action( ChoiceFactoryTest.choices_with_actions, "select from:") self.assertEqual(expected, activity)
def test_should_render_choices_as_suggested_actions(self): expected = Activity( type=ActivityTypes.message, text="select from:", input_hint=InputHints.expecting_input, suggested_actions=SuggestedActions(actions=[ CardAction(type=ActionTypes.im_back, value="red", title="red"), CardAction( type=ActionTypes.im_back, value="green", title="green"), CardAction( type=ActionTypes.im_back, value="blue", title="blue"), ]), ) activity = ChoiceFactory.suggested_action( ChoiceFactoryTest.color_choices, "select from:") self.assertEqual(expected, activity)
def suggested_action() -> Activity: return ChoiceFactory.suggested_action(choices, text)