def test_multi_choice_input_set_value(self):
     multi_choice_input = MultiChoiceInput()
     multi_choice_input.set_value("commodo")
     self.assertDictEqual(multi_choice_input.as_data(), {
         "@type": "MultichoiceInput",
         "value": "commodo"
     })
 def test_multi_choice_input_set_id(self):
     multi_choice_input = MultiChoiceInput()
     multi_choice_input.set_id("id_multi_choice_input")
     self.assertDictEqual(multi_choice_input.as_data(), {
         "@type": "MultichoiceInput",
         "id": "id_multi_choice_input"
     })
 def test_multi_choice_input_set_title(self):
     multi_choice_input = MultiChoiceInput()
     multi_choice_input.set_title("Aliquam")
     self.assertDictEqual(multi_choice_input.as_data(), {
         "@type": "MultichoiceInput",
         "title": "Aliquam"
     })
 def test_multi_choice_input_set_style(self):
     multi_choice_input = MultiChoiceInput()
     multi_choice_input.set_style(ChoiceStyle.EXPANDED)
     self.assertDictEqual(multi_choice_input.as_data(), {
         "@type": "MultichoiceInput",
         "style": "expanded"
     })
 def test_multi_choice_input_set_is_multi_select(self):
     multi_choice_input = MultiChoiceInput()
     multi_choice_input.set_is_multi_select()
     self.assertDictEqual(multi_choice_input.as_data(), {
         "@type": "MultichoiceInput",
         "isMultiSelect": True
     })
 def test_multi_choice_input_add_choice(self):
     multi_choice_input = MultiChoiceInput()
     multi_choice_input.add_choice(InputChoice("Blue", "b"))
     self.assertDictEqual(multi_choice_input.as_data(), {
         "@type": "MultichoiceInput",
         "choices": [
             {"display": "Blue", "value": "b"}
         ]
     })
 def test_multi_choice_input_add_choices(self):
     multi_choice_input = MultiChoiceInput()
     multi_choice_input.add_choices([InputChoice("Choice 1", "x"), InputChoice("Choice 2", "y")])
     self.assertDictEqual(multi_choice_input.as_data(), {
         "@type": "MultichoiceInput",
         "choices": [
             {"display": "Choice 1", "value": "x"},
             {"display": "Choice 2", "value": "y"}
         ]
     })
 def test_multi_choice_input(self):
     choices = [InputChoice("Option 1", 1), InputChoice("Option 2", 2)]
     multi_choice_input = MultiChoiceInput(input_id="id_choice", title="Select something", value=0, is_required=True,
                                           choices=choices, is_multi_select=True, style=ChoiceStyle.EXPANDED)
     self.assertDictEqual(multi_choice_input.as_data(), {
         "@type": "MultichoiceInput",
         "id": "id_choice",
         "title": "Select something",
         "value": 0,
         "isRequired": True,
         "choices": [
             {"display": "Option 1", "value": 1},
             {"display": "Option 2", "value": 2}
         ],
         "isMultiSelect": True,
         "style": "expanded"
     })
 def test_multi_choice_input_set_is_required(self):
     multi_choice_input = MultiChoiceInput()
     multi_choice_input.set_is_required(False)
     self.assertDictEqual(multi_choice_input.as_data(), {
         "@type": "MultichoiceInput",
         "isRequired": False
     })
     multi_choice_input.set_is_required(True)
     self.assertDictEqual(multi_choice_input.as_data(), {
         "@type": "MultichoiceInput",
         "isRequired": True
     })
     multi_choice_input.set_is_required()
     self.assertDictEqual(multi_choice_input.as_data(), {
         "@type": "MultichoiceInput",
         "isRequired": True
     })
 def test_multi_choice_input_choice_already_added(self):
     with self.assertRaisesMessage(CardException, "Choice with this 'value' [a] already added"):
         MultiChoiceInput(choices=[InputChoice("Name", "a"), InputChoice("Sample", "a")])
Ejemplo n.º 11
0
        facts=[
            Fact("Board:", "Name of board"),
            Fact("List:", "Name of list"),
            Fact("Assigned to:", "(none)"),
            Fact("Due date:", "(none)")
        ])
])
trello_card.add_actions([
    ActionCard(name="Set due date",
               inputs=[DateInput(input_id="dueDate", title="select a date")],
               actions=[HttpPOST("OK", target="http://...")]),
    ActionCard(name="Move",
               inputs=[
                   MultiChoiceInput(input_id="move",
                                    title="Pick a list",
                                    choices=[
                                        InputChoice("List 1", "l1"),
                                        InputChoice("List 2", "l2")
                                    ])
               ],
               actions=[HttpPOST("OK", target="http://...")]),
    ActionCard(name="Add a comment",
               inputs=[
                   TextInput(input_id="comment",
                             is_multiline=True,
                             title="Enter your comment")
               ],
               actions=[HttpPOST("OK", target="http://...")]),
    OpenUri("View in Trello",
            targets=[ActionTarget(OSType.DEFAULT, "http://...")])
])