MCPcopy Create free account
hub / github.com/slackapi/python-slack-sdk / test_json

Method test_json

tests/web/classes/test_blocks.py:377–391  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

375 self.assertDictEqual(input, ActionsBlock(**input).to_dict())
376
377 def test_json(self):
378 self.elements = [
379 ButtonElement(text="Click me", action_id="reg_button", value="1"),
380 LinkButtonElement(text="URL Button", url="http://google.com"),
381 ]
382 self.dict_elements = []
383 for e in self.elements:
384 self.dict_elements.append(e.to_dict())
385
386 self.assertDictEqual(
387 {"elements": self.dict_elements, "type": "actions"},
388 ActionsBlock(elements=self.elements).to_dict(),
389 )
390 with self.assertRaises(SlackObjectFormationError):
391 ActionsBlock(elements=self.elements * 13).to_dict()
392
393
394# ----------------------------------------------

Callers

nothing calls this directly

Calls 5

ButtonElementClass · 0.90
LinkButtonElementClass · 0.90
ActionsBlockClass · 0.90
appendMethod · 0.45
to_dictMethod · 0.45

Tested by

no test coverage detected