(self)
| 109 | self.assertDictEqual(input, SectionBlock(**input).to_dict()) |
| 110 | |
| 111 | def test_json(self): |
| 112 | self.assertDictEqual( |
| 113 | { |
| 114 | "text": {"text": "some text", "type": "mrkdwn"}, |
| 115 | "block_id": "a_block", |
| 116 | "type": "section", |
| 117 | }, |
| 118 | SectionBlock(text="some text", block_id="a_block").to_dict(), |
| 119 | ) |
| 120 | |
| 121 | self.assertDictEqual( |
| 122 | { |
| 123 | "text": {"text": "some text", "type": "mrkdwn"}, |
| 124 | "fields": [ |
| 125 | {"text": "field0", "type": "mrkdwn"}, |
| 126 | {"text": "field1", "type": "mrkdwn"}, |
| 127 | {"text": "field2", "type": "mrkdwn"}, |
| 128 | {"text": "field3", "type": "mrkdwn"}, |
| 129 | {"text": "field4", "type": "mrkdwn"}, |
| 130 | ], |
| 131 | "type": "section", |
| 132 | }, |
| 133 | SectionBlock(text="some text", fields=[f"field{i}" for i in range(5)]).to_dict(), |
| 134 | ) |
| 135 | |
| 136 | button = LinkButtonElement(text="Click me!", url="http://google.com") |
| 137 | self.assertDictEqual( |
| 138 | { |
| 139 | "type": "section", |
| 140 | "text": {"text": "some text", "type": "mrkdwn"}, |
| 141 | "accessory": button.to_dict(), |
| 142 | }, |
| 143 | SectionBlock(text="some text", accessory=button).to_dict(), |
| 144 | ) |
| 145 | |
| 146 | def test_text_or_fields_populated(self): |
| 147 | with self.assertRaises(SlackObjectFormationError): |
nothing calls this directly
no test coverage detected