diff --git a/CHANGELOG.md b/CHANGELOG.md index c7e484fc..fd9e1bb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog All notable changes to this project will be documented in this file. +## Unreleased + +### Bug Fixes +- Removing Pager Team integration, project appears to be discontinued + ## v1.15.0 - 2020-06-04 ### Improvements diff --git a/hc/api/tests/test_notify.py b/hc/api/tests/test_notify.py index c4054d01..36772d05 100644 --- a/hc/api/tests/test_notify.py +++ b/hc/api/tests/test_notify.py @@ -394,14 +394,10 @@ class NotifyTestCase(BaseTestCase): @patch("hc.api.transports.requests.request") def test_pagerteam(self, mock_post): self._setup_data("pagerteam", "123") - mock_post.return_value.status_code = 200 self.channel.notify(self.check) - assert Notification.objects.count() == 1 - - args, kwargs = mock_post.call_args - payload = kwargs["json"] - self.assertEqual(payload["event_type"], "trigger") + self.assertFalse(mock_post.called) + self.assertEqual(Notification.objects.count(), 0) @patch("hc.api.transports.requests.request") def test_slack(self, mock_post): diff --git a/hc/api/transports.py b/hc/api/transports.py index 8629a20e..e41b6fb2 100644 --- a/hc/api/transports.py +++ b/hc/api/transports.py @@ -331,20 +331,8 @@ class PagerTree(HttpTransport): class PagerTeam(HttpTransport): - def notify(self, check): - url = self.channel.value - headers = {"Content-Type": "application/json"} - payload = { - "incident_key": str(check.code), - "event_type": "trigger" if check.status == "down" else "resolve", - "title": tmpl("pagerteam_title.html", check=check), - "description": tmpl("pagerteam_description.html", check=check), - "client": settings.SITE_NAME, - "client_url": settings.SITE_ROOT, - "tags": ",".join(check.tags_list()), - } - - return self.post(url, json=payload, headers=headers) + def is_noop(self, check): + return True class Pushbullet(HttpTransport): diff --git a/hc/front/tests/test_add_pagerteam.py b/hc/front/tests/test_add_pagerteam.py deleted file mode 100644 index 80dad608..00000000 --- a/hc/front/tests/test_add_pagerteam.py +++ /dev/null @@ -1,32 +0,0 @@ -from hc.api.models import Channel -from hc.test import BaseTestCase - - -class AddPagerTeamTestCase(BaseTestCase): - def setUp(self): - super(AddPagerTeamTestCase, self).setUp() - self.url = "/projects/%s/add_pagerteam/" % self.project.code - - def test_instructions_work(self): - self.client.login(username="alice@example.org", password="password") - r = self.client.get(self.url) - self.assertContains(r, "Pager Team") - - def test_it_works(self): - form = {"value": "http://example.org"} - - self.client.login(username="alice@example.org", password="password") - r = self.client.post(self.url, form) - self.assertRedirects(r, self.channels_url) - - c = Channel.objects.get() - self.assertEqual(c.kind, "pagerteam") - self.assertEqual(c.value, "http://example.org") - self.assertEqual(c.project, self.project) - - def test_it_rejects_bad_url(self): - form = {"value": "not an URL"} - - self.client.login(username="alice@example.org", password="password") - r = self.client.post(self.url, form) - self.assertContains(r, "Enter a valid URL") diff --git a/hc/front/urls.py b/hc/front/urls.py index 08b547e4..0d9f44b8 100644 --- a/hc/front/urls.py +++ b/hc/front/urls.py @@ -61,7 +61,6 @@ project_urls = [ path("add_mattermost/", views.add_mattermost, name="hc-add-mattermost"), path("add_msteams/", views.add_msteams, name="hc-add-msteams"), path("add_opsgenie/", views.add_opsgenie, name="hc-add-opsgenie"), - path("add_pagerteam/", views.add_pagerteam, name="hc-add-pagerteam"), path("add_pagertree/", views.add_pagertree, name="hc-add-pagertree"), path("add_pd/", views.add_pd, name="hc-add-pd"), path("add_pdc/", views.add_pdc, name="hc-add-pdc"), diff --git a/hc/front/views.py b/hc/front/views.py index 44780d55..db7b0121 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -1029,26 +1029,6 @@ def add_pagertree(request, code): return render(request, "integrations/add_pagertree.html", ctx) -@login_required -def add_pagerteam(request, code): - project = _get_project_for_user(request, code) - - if request.method == "POST": - form = forms.AddUrlForm(request.POST) - if form.is_valid(): - channel = Channel(project=project, kind="pagerteam") - channel.value = form.cleaned_data["value"] - channel.save() - - channel.assign_all_checks() - return redirect("hc-p-channels", project.code) - else: - form = forms.AddUrlForm() - - ctx = {"page": "channels", "project": project, "form": form} - return render(request, "integrations/add_pagerteam.html", ctx) - - @login_required def add_slack(request, code): project = _get_project_for_user(request, code) diff --git a/static/img/integrations/setup_pagerteam_1.png b/static/img/integrations/setup_pagerteam_1.png deleted file mode 100644 index 63acf276..00000000 Binary files a/static/img/integrations/setup_pagerteam_1.png and /dev/null differ diff --git a/templates/docs/configuring_notifications.html b/templates/docs/configuring_notifications.html index 31fa580d..cd8786a8 100644 --- a/templates/docs/configuring_notifications.html +++ b/templates/docs/configuring_notifications.html @@ -33,8 +33,8 @@ not carry over to the next month.

If you want to receive repeated notifications for as long as a particular check is down, you have a few different options: