def test_should_render_choices_as_hero_card(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.hero_card(ChoiceFactoryTest.color_choices,
                                           "select from:")

        self.assertEqual(expected, activity)
 def test_ShouldIncludeChoiceActionsInHeroCards(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="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",
                         ),
                     ],
                 ),
                 content_type="application/vnd.microsoft.card.hero",
             )
         ],
     )
     activity = ChoiceFactory.hero_card(
         ChoiceFactoryTest.choices_with_actions, "select from:")
     self.assertEqual(expected, activity)
Ejemplo n.º 3
0
 def hero_card() -> Activity:
     return ChoiceFactory.hero_card(choices, text)