示例#1
0
    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)
示例#2
0
    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))
示例#3
0
    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)
示例#4
0
 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))
示例#5
0
 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))
示例#6
0
    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)
示例#7
0
    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)
示例#8
0
    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)