def test_low_priority_1p(self): incident = self._non_urgent_incident() with _mocking_weekend(): result = pager_parrot.format_message(incident, _CHANNEL_1P) self.assertNotIn('@channel', result) self.assertNotIn('@here', result) self.assertIn('text and email the person on-ping', result)
def test_low_priority_3p(self): incident = self._non_urgent_incident() with _mocking_weekend(): result = pager_parrot.format_message(incident, _CHANNEL_3P) self.assertNotIn('@channel', result) self.assertNotIn('@here', result) self.assertIn('dev team has been alerted', result)
def post(self): logging.info("Processing %s" % self.request.body) payload = json.loads(self.request.body) global pagerduty_ids_seen for message in payload['messages']: if (message['id'] not in pagerduty_ids_seen and message['type'] == 'incident.trigger'): should_ping = pager_parrot.consider_ping() # Only trigger if we haven't seen the message, and if it's a # trigger, rather than an acknowledgement or resolve. for channel in pager_parrot.CHANNELS: resp = _send_to_slack( pager_parrot.format_message( message['data']['incident'], channel, should_ping=should_ping), channel, 'Pager Parrot', ':parrot:', thread=pager_parrot.get_channel_thread(channel)) # We should stash any thread info for future use msg = resp.json() if 'ts' in msg: pager_parrot.set_channel_thread(channel, msg['ts']) pagerduty_ids_seen.add(message['id'])
def post(self): logging.info("Processing %s" % self.request.body) payload = json.loads(self.request.body) global pagerduty_ids_seen for message in payload['messages']: if (message['id'] not in pagerduty_ids_seen and message['type'] == 'incident.trigger' ): should_ping = pager_parrot.consider_ping() # Only trigger if we haven't seen the message, and if it's a # trigger, rather than an acknowledgement or resolve. for channel in pager_parrot.CHANNELS: _send_to_slack( pager_parrot.format_message( message['data']['incident'], channel, should_ping=should_ping), channel, 'Pager Parrot', ':parrot:') pagerduty_ids_seen.add(message['id'])
def test_medium_priority_1p(self): incident = self._non_urgent_incident() with _mocking_weekday(): result = pager_parrot.format_message(incident, _CHANNEL_1P) self.assertIn('@here', result) self.assertIn('text and email the support DRI', result)
def test_high_priority_3p_weekday(self): incident = self._urgent_incident() with _mocking_weekday(): result = pager_parrot.format_message(incident, _CHANNEL_3P) self.assertIn('@channel', result) self.assertIn('dev team has been alerted', result)
def test_high_priority_1p_weekend(self): incident = self._urgent_incident() with _mocking_weekend(): result = pager_parrot.format_message(incident, _CHANNEL_1P) self.assertIn('@channel', result) self.assertIn('start calling the P911 list', result)
def test_p0_pings_channel_in_support_on_weekday(self): incident = self._non_urgent_incident() with _mocking_weekday(): result = pager_parrot.format_message(incident, '#support') self.assertIn('@channel', result)
def test_p0_pings_channel_in_1s0s_on_weekday(self): incident = self._non_urgent_incident() with _mocking_weekday(): result = pager_parrot.format_message(incident, '#1s-and-0s') self.assertIn('@channel', result)
def test_p911_pings_channel_in_1s0s_and_support_on_weekend(self): incident = self._urgent_incident() with _mocking_weekend(): for channel in ('#1s-and-0s', '#support'): result = pager_parrot.format_message(incident, channel) self.assertIn('@channel', result)
def test_p911_pings_channel_in_1s0s_on_weekday(self): incident = self._urgent_incident() with _mocking_weekday(): result = pager_parrot.format_message(incident, '#1s-and-0s') self.assertIn('@channel', result)