-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
9 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -399,9 +399,9 @@ def test_mme_match_proxy_phenotype_only(self, mock_post_to_slack, mock_email): | |
mock.call().send(), | ||
]) | ||
|
||
@mock.patch('matchmaker.views.external_api.logger') | ||
@mock.patch('seqr.utils.communication_utils.logger') | ||
@mock.patch('matchmaker.views.external_api.EmailMessage') | ||
@mock.patch('matchmaker.views.external_api.safe_post_to_slack') | ||
@mock.patch('seqr.utils.communication_utils._post_to_slack') | ||
def test_mme_match_proxy_no_results(self, mock_post_to_slack, mock_email, mock_logger): | ||
url = '/api/matchmaker/v1/match' | ||
request_body = { | ||
|
@@ -424,11 +424,12 @@ def test_mme_match_proxy_no_results(self, mock_post_to_slack, mock_email, mock_l | |
self.assertEqual(incoming_query_q.count(), 1) | ||
self.assertIsNone(incoming_query_q.first().patient_id) | ||
|
||
mock_post_to_slack.assert_called_with( | ||
'matchmaker_matches', | ||
"""A match request for 12345 came in from Test Institute today. | ||
slack_message = """A match request for 12345 came in from Test Institute today. | ||
The contact information given was: [email protected]. | ||
We didn't find any individuals in matchbox that matched that query well, *so no results were sent back*.""" | ||
mock_post_to_slack.assert_called_with( | ||
'matchmaker_matches', | ||
slack_message | ||
) | ||
mock_email.assert_not_called() | ||
|
||
|
@@ -440,6 +441,6 @@ def test_mme_match_proxy_no_results(self, mock_post_to_slack, mock_email, mock_l | |
self.assertListEqual(response.json()['results'], []) | ||
self.assertEqual(MatchmakerIncomingQuery.objects.filter(institution='Test Institute').count(), 2) | ||
mock_logger.error.assert_called_with( | ||
'Unable to create notification for incoming MME match request for 0 matches: Slack connection error') | ||
f'Slack error: Slack connection error: Original message in channel (matchmaker_matches) - {slack_message}') | ||
|
||
|