-
Notifications
You must be signed in to change notification settings - Fork 1
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
11 changed files
with
88 additions
and
39 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
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 |
---|---|---|
|
@@ -59,16 +59,21 @@ def test_send_emails_network(): | |
## Init the authenticated email bot instance | ||
email_bot = EmailBot(c.EMAIL_USERNAME, c.EMAIL_PASSWORD) | ||
|
||
## Set paramaters (uses an anonymous email inbox for testing) | ||
## Send out nodes_down_message and nodes_status_message. We test both. | ||
## We append time to the subject to act as an identifier for the test. | ||
## Set recipient (we use an anonymous email inbox for testing) | ||
recipients = ['[email protected]'] | ||
subject1, message1 = messages.nodes_down_message([fakenode], fakelabel) | ||
subject1 = str(f'{time.time()} - {subject1}') | ||
email_bot.send_emails(recipients, subject1, message1) | ||
|
||
subject2, message2 = messages.nodes_status_message([fakenode], fakelabel) | ||
## Create the messages. We use unittest.mock.patch to remove the private URL. | ||
with patch.object(c, 'FEEDBACK_FORM_URL', 'https://url-has-been-redacted.ninja'): | ||
subject1, message1 = messages.nodes_down_message([fakenode], fakelabel) | ||
subject2, message2 = messages.nodes_status_message([fakenode], fakelabel) | ||
|
||
## Append the time to the subject to act as an identifier for the test, | ||
## making it easy to do a regex search to validate the email. | ||
subject1 = str(f'{time.time()} - {subject1}') | ||
subject2 = str(f'{time.time()} - {subject2}') | ||
|
||
## Send both nodes_down_message and nodes_status_message as emails. | ||
email_bot.send_emails(recipients, subject1, message1) | ||
email_bot.send_emails(recipients, subject2, message2) | ||
|
||
## Automatically check the email inbox | ||
|
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