def action_from_webhook_MessageAction(self): action = action_from_webhook(WEBHOOK_MESSAGE_ACTION) self.assertTrue(action.callback_id == 'pivotal') self.assertTrue( action.trigger_id == '472869436786.47444502659.884405da2a25311a4bcae9ddfaf23c07') self.assertTrue(action.response_url == 'test_url') self.assertTrue(type(action) == MessageAction)
def action_from_webhook_ViewBlockAction(self): action = action_from_webhook(WEBHOOK_VIEW_BLOCK_ACTION) self.assertTrue(type(action.view.blocks[0]) == SectionBlock) self.assertTrue(type(action.view.blocks[1]) == DividerBlock) self.assertTrue(type(action.view.blocks[2]) == ActionsBlock) self.assertTrue(type(action.view.blocks[0].accessory) == ButtonElement) # TODO: Now in slackclient 2.9.3 ActionsBlock elements are not parsed, but it will be fixed in 2.9.4 # self.assertTrue(type(action.view.blocks[2].elements[0]) == ButtonElement) self.assertTrue(isinstance(action, BlockAction))
def action_from_webhook_DialogSubmissionAction(self): action = action_from_webhook(WEBHOOK_DIALOG_SUBMISSION_ACTION) self.assertTrue(action.callback_id == 'pivotal-ticket') self.assertTrue(action.response_url == 'test_url') self.assertTrue(action.submission == { 'field_1': 'val 1', 'field_2': 'val 2' }) self.assertTrue(type(action) == DialogSubmissionAction)
def action_from_webhook_ModalCancelAction(self): action = action_from_webhook(WEBHOOK_MODAL_CANCEL_ACTION) self.assertTrue( action.callback_id == VIEW_WEBHOOK_TEMPLATE['view']['callback_id']) self.assertTrue(isinstance(action, ViewCancelAction))
def action_from_webhook_ModalSubmissionAction(self): action = action_from_webhook(WEBHOOK_MODAL_SUBMISSION_ACTION) self.assertTrue( action.callback_id == VIEW_WEBHOOK_TEMPLATE['view']['callback_id']) self.assertTrue(isinstance(action, ViewSubmissionAction))
def action_from_webhook_Action(self): action = action_from_webhook(WEBHOOK_ACTION) self.assertTrue(action.callback_id == 'test_callback_id') self.assertTrue(type(action) == Action)
def action_from_webhook_SelectAction(self): action = action_from_webhook(WEBHOOK_SELECT) self.assertTrue(action.trigger_id == 'test_trigger_id') self.assertTrue(action.response_url == 'test_url') self.assertTrue(type(action) == SelectAction)
def action_from_webhook_ButtonAction(self): action = action_from_webhook(WEBHOOK_BUTTON) self.assertTrue(action.trigger_id == 'test_trigger_id') self.assertTrue(action.response_url == 'test_url') self.assertTrue(type(action) == ButtonAction)