def test_document(self): input = { "type": "radio_buttons", "action_id": "this_is_an_action_id", "initial_option": { "value": "A1", "text": { "type": "plain_text", "text": "Radio 1" } }, "options": [{ "value": "A1", "text": { "type": "plain_text", "text": "Radio 1" } }, { "value": "A2", "text": { "type": "plain_text", "text": "Radio 2" } }], "initial_option": { "value": "A2", "text": { "type": "plain_text", "text": "Radio 2" } } } self.assertDictEqual(input, RadioButtonsElement(**input).to_dict())
def test_valid_construction(self): modal_view = View( type="modal", callback_id="modal-id", title=PlainTextObject(text="Awesome Modal"), submit=PlainTextObject(text="Submit"), close=PlainTextObject(text="Cancel"), blocks=[ InputBlock( block_id="b-id", label=PlainTextObject(text="Input label"), element=PlainTextInputElement(action_id="a-id"), ), InputBlock( block_id="cb-id", label=PlainTextObject(text="Label"), element=CheckboxesElement( action_id="a-cb-id", options=[ Option( text=PlainTextObject( text="*this is plain_text text*"), value="v1", ), Option( text=MarkdownTextObject( text="*this is mrkdwn text*"), value="v2", ), ], ), ), SectionBlock( block_id="sb-id", text=MarkdownTextObject( text="This is a mrkdwn text section block."), fields=[ PlainTextObject(text="*this is plain_text text*", emoji=True), MarkdownTextObject(text="*this is mrkdwn text*"), PlainTextObject(text="*this is plain_text text*", emoji=True), ], ), DividerBlock(), SectionBlock( block_id="rb-id", text=MarkdownTextObject( text= "This is a section block with radio button accessory"), accessory=RadioButtonsElement( initial_option=Option( text=PlainTextObject(text="Option 1"), value="option 1", description=PlainTextObject( text="Description for option 1"), ), options=[ Option( text=PlainTextObject(text="Option 1"), value="option 1", description=PlainTextObject( text="Description for option 1"), ), Option( text=PlainTextObject(text="Option 2"), value="option 2", description=PlainTextObject( text="Description for option 2"), ), ], ), ), ], ) modal_view.validate_json()