Skip to content

Commit

Permalink
Add new action to OpsGenieWebhook for apprise==1.9.0 compatibil…
Browse files Browse the repository at this point in the history
…ity (#16030)
  • Loading branch information
kevingrismore authored Nov 18, 2024
1 parent 2bf9d05 commit a8ac0e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/prefect/blocks/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ def block_initialization(self) -> None:
entity=self.entity,
batch=self.batch,
tags=self.tags,
action="new",
).url()
)
self._start_apprise_client(url)
Expand Down
8 changes: 4 additions & 4 deletions tests/blocks/test_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ async def test_notify_async(self):

AppriseMock.assert_called_once()
apprise_instance_mock.add.assert_called_once_with(
f"opsgenie://{self.API_KEY}//?action=map&region=us&priority=normal&"
f"opsgenie://{self.API_KEY}//?action=new&region=us&priority=normal&"
"batch=no&%3Ainfo=note&%3Asuccess=close&%3Awarning=new&%3Afailure="
"new&format=text&overflow=upstream"
)
Expand All @@ -304,7 +304,7 @@ async def test_notify_async(self):
def _test_notify_sync(self, targets="", params=None, **kwargs):
with patch("apprise.Apprise", autospec=True) as AppriseMock:
if params is None:
params = "action=map&region=us&priority=normal&batch=no"
params = "action=new&region=us&priority=normal&batch=no"

apprise_instance_mock = AppriseMock.return_value
apprise_instance_mock.async_notify = AsyncMock()
Expand All @@ -331,7 +331,7 @@ def test_notify_sync_simple(self):
self._test_notify_sync()

def test_notify_sync_params(self):
params = "action=map&region=eu&priority=low&batch=yes"
params = "action=new&region=eu&priority=low&batch=yes"
self._test_notify_sync(params=params, region_name="eu", priority=1, batch=True)

def test_notify_sync_targets(self):
Expand All @@ -349,7 +349,7 @@ def test_notify_sync_users(self):
self._test_notify_sync(targets=targets, target_user=["user1", "user2"])

def test_notify_sync_details(self):
params = "action=map&region=us&priority=normal&batch=no&%2Bkey1=value1&%2Bkey2=value2"
params = "action=new&region=us&priority=normal&batch=no&%2Bkey1=value1&%2Bkey2=value2"
self._test_notify_sync(
params=params,
details={
Expand Down

0 comments on commit a8ac0e5

Please sign in to comment.