Skip to content

Commit

Permalink
(bugfix): replace create_event with send_event in `PagerdutyNotif…
Browse files Browse the repository at this point in the history
…ier` (apache#45630)

* (bugfix): replace `create_event`  with `send_event`  in `PagerdutyNotifier`
---------

Co-authored-by: Brandon Shea <[email protected]>
  • Loading branch information
bshea5 and Brandon Shea authored Jan 15, 2025
1 parent 8648366 commit e164f3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def hook(self) -> PagerdutyEventsHook:

def notify(self, context):
"""Send a alert to a pagerduty event v2 API."""
self.hook.create_event(
self.hook.send_event(
summary=self.summary,
severity=self.severity,
source=self.source,
Expand Down
6 changes: 3 additions & 3 deletions providers/tests/pagerduty/notifications/test_pagerduty.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_notifier(self, mock_pagerduty_event_hook, dag_maker):
EmptyOperator(task_id="task1")
notifier = send_pagerduty_notification(summary="DISK at 99%", severity="critical", action="trigger")
notifier({"dag": dag})
mock_pagerduty_event_hook.return_value.create_event.assert_called_once_with(
mock_pagerduty_event_hook.return_value.send_event.assert_called_once_with(
summary="DISK at 99%",
severity="critical",
action="trigger",
Expand All @@ -61,7 +61,7 @@ def test_notifier_with_notifier_class(self, mock_pagerduty_event_hook, dag_maker
EmptyOperator(task_id="task1")
notifier = PagerdutyNotifier(summary="DISK at 99%", severity="critical", action="trigger")
notifier({"dag": dag})
mock_pagerduty_event_hook.return_value.create_event.assert_called_once_with(
mock_pagerduty_event_hook.return_value.send_event.assert_called_once_with(
summary="DISK at 99%",
severity="critical",
action="trigger",
Expand Down Expand Up @@ -97,7 +97,7 @@ def test_notifier_templated(self, mock_pagerduty_event_hook, dag_maker):
)
context = {"dag": dag}
notifier(context)
mock_pagerduty_event_hook.return_value.create_event.assert_called_once_with(
mock_pagerduty_event_hook.return_value.send_event.assert_called_once_with(
action="trigger",
summary="DISK at 99% test_notifier",
severity="critical test_notifier",
Expand Down

0 comments on commit e164f3c

Please sign in to comment.