0
0
Fork 0
mirror of https://github.com/healthchecks/healthchecks.git synced 2025-04-05 05:15:26 +00:00

Fix the Trello integration to use Flip.new_status

This commit is contained in:
Pēteris Caune 2024-04-12 15:34:54 +03:00
parent bcecf058c2
commit 6e27d88ec9
No known key found for this signature in database
GPG key ID: E28D7679E9A9EDE2
3 changed files with 7 additions and 5 deletions

View file

@ -18,7 +18,9 @@ class NotifyTrelloTestCase(BaseTestCase):
self.check = Check(project=self.project)
self.check.name = "Foo"
self.check.status = "down"
# Transport classes should use flip.new_status,
# so the status "paused" should not appear anywhere
self.check.status = "paused"
self.check.last_ping = now() - td(minutes=61)
self.check.save()

View file

@ -1089,14 +1089,14 @@ class Trello(HttpTransport):
def is_noop(self, status: str) -> bool:
return status != "down"
def notify(self, check: Check, notification: Notification) -> None:
def notify_flip(self, flip: Flip, notification: Notification) -> None:
if not settings.TRELLO_APP_KEY:
raise TransportError("Trello notifications are not enabled.")
params = {
"idList": self.channel.trello.list_id,
"name": tmpl("trello_name.html", check=check),
"desc": tmpl("trello_desc.html", check=check),
"name": tmpl("trello_name.html", check=flip.owner, status=flip.new_status),
"desc": tmpl("trello_desc.html", check=flip.owner),
"key": settings.TRELLO_APP_KEY,
"token": self.channel.trello.token,
}

View file

@ -1,4 +1,4 @@
{% if check.status == "down" %}
{% if status == "down" %}
Down: {{ check.name_then_code|safe }}
{% else %}
Up: {{ check.name_then_code|safe }}