-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDAN-713 Add the ability to add an email address to a Monitoring prof…
…ile (#1159)
- Loading branch information
1 parent
af82ad6
commit 261dc25
Showing
7 changed files
with
68 additions
and
4 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
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
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
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 |
---|---|---|
|
@@ -948,3 +948,26 @@ def test_save_only_users_belonging_to_company(client, app): | |
}), content_type='application/json') | ||
m = app.data.find_one('monitoring', None, _id="5db11ec55f627d8aa0b545fb") | ||
assert m['users'] == [ObjectId("5c53afa45f627d8333220f15")] | ||
|
||
|
||
@mock.patch('newsroom.monitoring.email_alerts.utcnow', mock_utcnow) | ||
@mock.patch('newsroom.email.send_email', mock_send_email) | ||
def test_send_profile_email(client, app): | ||
test_login_succeeds_for_admin(client) | ||
app.data.insert('items', [{ | ||
'_id': 'foo', | ||
'headline': 'product immediate', | ||
'products': [{'code': '12345'}], | ||
"versioncreated": utcnow(), | ||
'byline': 'Testy McTestface', | ||
'body_html': '<p>line 1 of the article text\nline 2 of the story\nand a bit more.</p>', | ||
'source': 'AAAA' | ||
}]) | ||
m = app.data.find_one('monitoring', None, _id="5db11ec55f627d8aa0b545fb") | ||
assert m is not None | ||
app.data.update('monitoring', ObjectId("5db11ec55f627d8aa0b545fb"), {'email': '[email protected], [email protected]'}, m) | ||
with app.mail.record_messages() as outbox: | ||
MonitoringEmailAlerts().run(immediate=True) | ||
assert len(outbox) == 1 | ||
assert '[email protected]' in outbox[0].recipients | ||
assert '[email protected]' in outbox[0].recipients |