Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Mattermost alert webhook call #5700

Merged
merged 1 commit into from
May 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cfgov/alerts/mattermost_alert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import os

import requests
Expand All @@ -24,6 +23,6 @@ def post(self, text):
}
resp = requests.post(
self.webhook_url,
data=json.dumps(payload),
json=payload,
)
resp.raise_for_status()
9 changes: 5 additions & 4 deletions cfgov/alerts/tests/test_mattermost_alert.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
import json

from django.test import TestCase

Expand All @@ -24,7 +23,9 @@ def test_post(self, mock):
MattermostAlert(credentials, icon_url=icon).post(text)
mock.assert_called_once_with(
webhook_url,
data=json.dumps({'text': text,
'username': username,
'icon_url': icon})
json={
'text': text,
'username': username,
'icon_url': icon
}
)