Exemple #1
0
 def test_simple(self):
     alert_rule = self.create_alert_rule(resolve_threshold=200)
     trigger = create_alert_rule_trigger(alert_rule, "hi", 1000)
     result = serialize(trigger,
                        serializer=DetailedAlertRuleTriggerSerializer())
     self.assert_alert_rule_trigger_serialized(trigger, result)
     assert result["excludedProjects"] == []
Exemple #2
0
 def test_excluded_projects(self):
     excluded = [self.create_project()]
     alert_rule = self.create_alert_rule(projects=excluded, resolve_threshold=200)
     trigger = create_alert_rule_trigger(alert_rule, "hi", 1000, excluded_projects=excluded)
     result = serialize(trigger, serializer=DetailedAlertRuleTriggerSerializer())
     self.assert_alert_rule_trigger_serialized(trigger, result)
     assert result["excludedProjects"] == [p.slug for p in excluded]
    def test_simple(self):
        self.create_team(organization=self.organization, members=[self.user])
        self.login_as(self.user)
        with self.feature("organizations:incidents"):
            resp = self.get_valid_response(
                self.organization.slug, self.alert_rule.id, self.trigger.id
            )

        assert resp.data == serialize(self.trigger, serializer=DetailedAlertRuleTriggerSerializer())
 def get(self, request, organization, alert_rule, alert_rule_trigger):
     """
     Fetch an alert rule trigger.
     ``````````````````
     :auth: required
     """
     data = serialize(alert_rule_trigger, request.user,
                      DetailedAlertRuleTriggerSerializer())
     return Response(data)