Skip to content

Commit

Permalink
Merge pull request #796 from ministryofjustice/ag--fix-slack-notifica…
Browse files Browse the repository at this point in the history
…tions

Fix creation of superusers
  • Loading branch information
xoen authored Feb 11, 2020
2 parents d9ef133 + ec3d19f commit 9e5ac4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 3 additions & 4 deletions controlpanel/api/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ def notify_superuser_created(username, by_username=None):


def send_notification(message):
slack.WebClient(token=settings.SLACK['api_token']).chat_postMessage(
as_user=False,
username=f"Control Panel [{settings.ENV}]",
client = slack.WebClient(token=settings.SLACK['api_token'])
client.chat_postMessage(
channel=settings.SLACK["channel"],
text=message,
text=f"{message} [{settings.ENV}]",
)
4 changes: 1 addition & 3 deletions tests/api/test_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ def message_sent(settings, slack_WebClient):
def check_sent(message):
slack_WebClient.assert_called_with(token=settings.SLACK["api_token"])
slack_WebClient.return_value.chat_postMessage.assert_called_with(
as_user=False,
username=f"Control Panel [{settings.ENV}]",
channel=settings.SLACK["channel"],
text=message,
text=f"{message} [{settings.ENV}]",
)
return True
return check_sent
Expand Down

0 comments on commit 9e5ac4f

Please sign in to comment.