Skip to content

Commit 58289a4

Browse files
committed
Update the test to create a mock workflow event data that will throw instead of manipulating a frozen dataset
1 parent e780da3 commit 58289a4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/sentry/notifications/notification_action/test_metric_alert_registry_handlers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import pytest
99
from django.utils import timezone
1010

11+
from sentry.db.models import NodeData
12+
from sentry.eventstore.models import GroupEvent
1113
from sentry.incidents.grouptype import MetricIssue, MetricIssueEvidenceData
1214
from sentry.incidents.models.alert_rule import (
1315
AlertRuleDetectionType,
@@ -282,7 +284,10 @@ def setUp(self):
282284
self.handler = TestHandler()
283285

284286
def test_missing_occurrence_raises_value_error(self):
285-
self.event_data.event._occurrence = None
287+
self.event_data = WorkflowEventData(
288+
event=GroupEvent(self.project.id, "test", self.group, NodeData("test-id")),
289+
group=self.group,
290+
)
286291

287292
with pytest.raises(ValueError):
288293
self.handler.invoke_legacy_registry(self.event_data, self.action, self.detector)

0 commit comments

Comments
 (0)