def test_should_choose_correct_styles_for_teams(self): expected = Activity( type=ActivityTypes.message, input_hint=InputHints.expecting_input, attachment_layout=AttachmentLayoutTypes.list, attachments=[ Attachment( content=HeroCard( text="select from:", buttons=[ 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"), ], ), content_type="application/vnd.microsoft.card.hero", ) ], ) activity = ChoiceFactory.for_channel(Channels.ms_teams, ChoiceFactoryTest.color_choices, "select from:") self.assertEqual(expected, activity)
async def _show_choices(self, turn_context: TurnContext): choices = [ Choice( value=QUICK_REPLIES_OPTION, action=CardAction( title=QUICK_REPLIES_OPTION, type=ActionTypes.post_back, value=QUICK_REPLIES_OPTION, ), ), Choice( value=FACEBOOK_PAGEID_OPTION, action=CardAction( title=FACEBOOK_PAGEID_OPTION, type=ActionTypes.post_back, value=FACEBOOK_PAGEID_OPTION, ), ), Choice( value=POSTBACK_OPTION, action=CardAction( title=POSTBACK_OPTION, type=ActionTypes.post_back, value=POSTBACK_OPTION, ), ), ] message = ChoiceFactory.for_channel( turn_context.activity.channel_id, choices, "What Facebook feature would you like to try? Here are some quick replies to choose from!", ) await turn_context.send_activity(message)
def test_should_automatically_choose_render_style_based_on_channel_type( 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.for_channel(Channels.emulator, ChoiceFactoryTest.color_choices, "select from:") self.assertEqual(expected, activity)
def default() -> Activity: return ChoiceFactory.for_channel(channel_id, choices, text, None, options)