-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from moshthepitt/fix-emails
Cleanup emails
- Loading branch information
Showing
4 changed files
with
45 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
""" | ||
Main init file for small_small_hr | ||
""" | ||
VERSION = (0, 1, 3) | ||
VERSION = (0, 1, 4) | ||
__version__ = '.'.join(str(v) for v in VERSION) | ||
# pylint: disable=invalid-name | ||
default_app_config = 'small_small_hr.apps.SmallSmallHrConfig' # noqa |
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 |
---|---|---|
|
@@ -19,7 +19,9 @@ | |
|
||
|
||
@override_settings( | ||
HR_ADMIN_EMAILS=["[email protected]"] | ||
SSHR_ADMIN_EMAILS=["[email protected]"], | ||
SSHR_ADMIN_LEAVE_EMAILS=["[email protected]"], | ||
SSHR_ADMIN_OVERTIME_EMAILS=["[email protected]"] | ||
) | ||
class TestEmails(TestCase): | ||
""" | ||
|
@@ -81,7 +83,8 @@ def test_leave_processed_email(self, mock): | |
email="[email protected]", | ||
subject="Your leave application has been processed", | ||
message="You leave application status is Approved. Log in for more info.", # noqa | ||
obj=leave | ||
obj=leave, | ||
cc_list=['[email protected]'] | ||
) | ||
|
||
@patch('small_small_hr.emails.send_email') | ||
|
@@ -101,7 +104,7 @@ def test_overtime_application_email(self, mock): | |
|
||
mock.assert_called_with( | ||
name="Bob Ndoe", | ||
email="hr@example.com", | ||
email="ot@example.com", | ||
subject="New Overtime Application", | ||
message="There has been a new overtime application. Please log in to process it.", # noqa | ||
obj=overtime | ||
|
@@ -127,7 +130,8 @@ def test_overtime_processed_email(self, mock): | |
email="[email protected]", | ||
subject="Your overtime application has been processed", | ||
message="You overtime application status is Rejected. Log in for more info.", # noqa | ||
obj=overtime | ||
obj=overtime, | ||
cc_list=['[email protected]'] | ||
) | ||
|
||
def test_send_email(self): | ||
|
@@ -141,14 +145,16 @@ def test_send_email(self): | |
'name': 'Bob Munro', | ||
'email': '[email protected]', | ||
'subject': "I love oov", | ||
'message': message | ||
'message': message, | ||
'cc_list': settings.SSHR_ADMIN_EMAILS | ||
} | ||
|
||
send_email(**data) | ||
|
||
self.assertEqual(len(mail.outbox), 1) | ||
self.assertEqual(mail.outbox[0].subject, 'I love oov') | ||
self.assertEqual(mail.outbox[0].to, ['Bob Munro <[email protected]>']) | ||
self.assertEqual(mail.outbox[0].cc, ['[email protected]']) | ||
self.assertEqual( | ||
mail.outbox[0].body, | ||
'Hello Bob Munro,\n\nThe quick brown fox.\n\nThank you,\n\n' | ||
|