-
-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial work for #1377, weekly email for managers
Send a simple email template with the task histories on a project to it's manager with a weekly date range Added a simple test for it and added skips for tests instead of returning as true.
- Loading branch information
Showing
7 changed files
with
93 additions
and
21 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
Empty file.
7 changes: 7 additions & 0 deletions
7
server/services/messaging/templates/weekly_email_managers_en.txt
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Hi [USERNAME] | ||
|
||
This is the weekly update for your project: [PROJECT_NAME] | ||
|
||
[PROJECT_NAME] had [NUM_CONTRIBUTIONS] contributions this week. | ||
|
||
[CONTRIBUTION_LIST] |
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 |
---|---|---|
|
@@ -12,7 +12,6 @@ class TestStatsService(unittest.TestCase): | |
@classmethod | ||
def setUpClass(cls): | ||
env = os.getenv('CI', 'false') | ||
|
||
# Firewall rules mean we can't hit Postgres from CI so we have to skip them in the CI build | ||
if env == 'true': | ||
cls.skip_tests = True | ||
|
@@ -25,31 +24,32 @@ def setUp(self): | |
def tearDown(self): | ||
self.ctx.pop() | ||
|
||
@unittest.skipIf(not os.getenv('TM_SMTP_HOST'), 'TM_SMTP_HOST not set') | ||
def test_send_verification_mail(self): | ||
if self.skip_tests: | ||
return | ||
|
||
if os.getenv('TM_SMTP_HOST') is None: | ||
return # If SMTP not setup there's no value attempting the integration tests | ||
self.skipTest('CI build') | ||
|
||
self.assertTrue(SMTPService.send_verification_email('[email protected]', 'mrtest')) | ||
|
||
def test_send_alert(self): | ||
@unittest.skipIf(not os.getenv('TM_SMTP_HOST'), 'TM_SMTP_HOST not set') | ||
def test_send_templated_email(self): | ||
if self.skip_tests: | ||
return | ||
self.skipTest('CI build') | ||
|
||
if os.getenv('TM_SMTP_HOST') is None: | ||
return # If SMTP not setup there's no value attempting the integration tests | ||
self.assertTrue(SMTPService.send_templated_email('[email protected]', 'Test send templated email', 'weekly_email_managers_en', {})) | ||
|
||
@unittest.skipIf(not os.getenv('TM_SMTP_HOST'), 'TM_SMTP_HOST not set') | ||
def test_send_alert(self): | ||
if self.skip_tests: | ||
self.skipTest('CI build') | ||
|
||
self.assertTrue(SMTPService.send_email_alert('[email protected]', | ||
'Iain Hunter')) | ||
|
||
@unittest.skipIf(not os.getenv('TM_SMTP_HOST'), 'TM_SMTP_HOST not set') | ||
def test_send_alert_message_limits(self): | ||
if self.skip_tests: | ||
return | ||
|
||
if os.getenv('TM_SMTP_HOST') is None: | ||
return # If SMTP not setup there's no value attempting the integration tests | ||
self.skipTest('CI build') | ||
|
||
for x in range(0, 50): | ||
self.assertTrue(SMTPService.send_email_alert('[email protected]', | ||
|