def test_user(self): action = self.create_alert_rule_trigger_action( target_identifier=six.text_type(self.user.id)) incident = self.create_incident() handler = EmailActionHandler(action, incident, self.project) with self.tasks(): handler.fire() out = mail.outbox[0] assert out.to == [self.user.email] assert out.subject.startswith("Incident Alert Rule Fired")
def test_user(self): action = self.create_alert_rule_trigger_action( target_identifier=six.text_type(self.user.id) ) incident = self.create_incident(status=IncidentStatus.CRITICAL.value) handler = EmailActionHandler(action, incident, self.project) with self.tasks(): handler.fire() out = mail.outbox[0] assert out.to == [self.user.email] assert out.subject == u"[Critical] {} - {}".format(incident.title, self.project.slug)
def run_test(self, incident, method): action = self.create_alert_rule_trigger_action( target_identifier=str(self.user.id), triggered_for_incident=incident, ) handler = EmailActionHandler(action, incident, self.project) with self.tasks(): handler.fire(1000) out = mail.outbox[0] assert out.to == [self.user.email] assert out.subject == "[{}] {} - {}".format( INCIDENT_STATUS[IncidentStatus(incident.status)], incident.title, self.project.slug)