def test_date_input_set_include_time(self):
     date_input = DateInput()
     date_input.set_include_time()
     self.assertDictEqual(date_input.as_data(), {
         "@type": "DateInput",
         "includeTime": True
     })
 def test_date_input_set_value(self):
     date_input = DateInput()
     date_input.set_value("mauris")
     self.assertDictEqual(date_input.as_data(), {
         "@type": "DateInput",
         "value": "mauris"
     })
 def test_date_input_set_title(self):
     date_input = DateInput()
     date_input.set_title("viverra")
     self.assertDictEqual(date_input.as_data(), {
         "@type": "DateInput",
         "title": "viverra"
     })
 def test_date_input_set_id(self):
     date_input = DateInput()
     date_input.set_id("id_date_input")
     self.assertDictEqual(date_input.as_data(), {
         "@type": "DateInput",
         "id": "id_date_input"
     })
 def test_date_input(self):
     date_input = DateInput(input_id="id_date", title="Date", value=37, is_required=True, include_time=True)
     self.assertDictEqual(date_input.as_data(), {
         "@type": "DateInput",
         "id": "id_date",
         "title": "Date",
         "value": 37,
         "isRequired": True,
         "includeTime": True
     })
 def test_action_card_add_inputs(self):
     action_card = ActionCard("Inputs")
     action_card.add_inputs([
         DateInput(include_time=True),
         TextInput(input_id="id_text", max_length=16, is_multiline=True)
     ])
     self.assertDictEqual(
         action_card.as_data(), {
             "@type":
             "ActionCard",
             "name":
             "Inputs",
             "inputs": [{
                 "@type": "DateInput",
                 "includeTime": True
             }, {
                 "@type": "TextInput",
                 "id": "id_text",
                 "isMultiline": True,
                 "maxLength": 16
             }]
         })
     action_card.add_inputs(TextInput(max_length=64, is_multiline=True))
     self.assertDictEqual(
         action_card.as_data(), {
             "@type":
             "ActionCard",
             "name":
             "Inputs",
             "inputs": [{
                 "@type": "DateInput",
                 "includeTime": True
             }, {
                 "@type": "TextInput",
                 "id": "id_text",
                 "isMultiline": True,
                 "maxLength": 16
             }, {
                 "@type": "TextInput",
                 "isMultiline": True,
                 "maxLength": 64
             }]
         })
 def test_date_input_set_is_required(self):
     date_input = DateInput()
     date_input.set_is_required(False)
     self.assertDictEqual(date_input.as_data(), {
         "@type": "DateInput",
         "isRequired": False
     })
     date_input.set_is_required(True)
     self.assertDictEqual(date_input.as_data(), {
         "@type": "DateInput",
         "isRequired": True
     })
     date_input.set_is_required()
     self.assertDictEqual(date_input.as_data(), {
         "@type": "DateInput",
         "isRequired": True
     })
Ejemplo n.º 8
0
trello_card.add_sections([
    Section(
        activity_title="Miguel Garcia",
        activity_subtitle="9/13/2016, 3:34pm",
        activity_image=
        "https://connectorsdemo.azurewebsites.net/images/MSC12_Oscar_002.jpg",
        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,