Пример #1
0
 def post(self):
     """
     Update an alert in the system through a Slack message
     """
     send_slack_log('Entered /slack/update_alert')
     send_slack_log('Request info:')
     send_slack_log(str(request.form))
     trigger_id = request.form['trigger_id']
     channel_id = request.form['channel_id']
     response = open_form(channel_id, trigger_id,
                          config['slack_update_form_path'])
     send_slack_log('Response info:')
     send_slack_log(str(response))
     return 'Please enter the updated alert information in the form'
Пример #2
0
 def post(self):
     """
     Filter alerts in the system through a Slack message
     """
     send_slack_log('Entered /slack/filter_alerts')
     send_slack_log('Request info:')
     send_slack_log(str(request.form))
     trigger_id = request.form['trigger_id']
     channel_id = request.form['channel_id']
     response = open_form(channel_id, trigger_id,
                          config['slack_filter_form_path'])
     send_slack_log('Response info:')
     send_slack_log(str(response))
     return 'Please enter alerts filtering information in the form'
Пример #3
0
 def testOpenForm(self):
     """
     Testing if open_form works
     """
     responses.add(
         **{
             'method': responses.POST,
             'url': slack_config['Views_Open_URL'],
             'body': 'ok',
             'status': 200,
             'content_type': 'application/json'
         })
     response = open_form('my_channel', 'my_tigger_id',
                          'test_data/slack/post_msg_form.json')
     self.assertEqual('ok', response[200])
Пример #4
0
 def post(self):
     """
     Post a new message into the system through a Slack message
     """
     send_slack_log('Entered /slack/post_msg')
     send_slack_log('Request info:')
     send_slack_log(str(request.form))
     # unknown request.form
     trigger_id = request.form['trigger_id']
     channel_id = request.form['channel_id']
     response = open_form(channel_id, trigger_id,
                          config['slack_post_form_path'])
     send_slack_log('Response info:')
     send_slack_log(str(response))
     return 'Please enter the new msg information in the form'