Skip to content

Commit

Permalink
Merge pull request #27 from moshthepitt/issue-26
Browse files Browse the repository at this point in the history
Fix name in application emails
  • Loading branch information
moshthepitt authored Feb 12, 2019
2 parents da41dd7 + e5bfb5f commit d02fc93
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion small_small_hr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Main init file for small_small_hr
"""
VERSION = (0, 1, 5)
VERSION = (0, 1, 6)
__version__ = '.'.join(str(v) for v in VERSION)
# pylint: disable=invalid-name
default_app_config = 'small_small_hr.apps.SmallSmallHrConfig' # noqa
4 changes: 2 additions & 2 deletions small_small_hr/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def leave_application_email(leave_obj: object):

for admin_email in admin_emails:
send_email(
name=leave_obj.staff.get_name(),
name=settings.SSHR_ADMIN_NAME,
email=admin_email,
subject=subj,
message=msg,
Expand Down Expand Up @@ -118,7 +118,7 @@ def overtime_application_email(overtime_obj: object):

for admin_email in admin_emails:
send_email(
name=overtime_obj.staff.get_name(),
name=settings.SSHR_ADMIN_NAME,
email=admin_email,
subject=subj,
message=msg,
Expand Down
1 change: 1 addition & 0 deletions small_small_hr/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
{'day': 26, 'month': 12}, # Boxing day
] # these are days that are not counted when getting taken leave days
# emails
SSHR_ADMIN_NAME = "HR"
SSHR_ADMIN_EMAILS = [settings.DEFAULT_FROM_EMAIL]
SSHR_ADMIN_LEAVE_EMAILS = SSHR_ADMIN_EMAILS
SSHR_ADMIN_OVERTIME_EMAILS = SSHR_ADMIN_EMAILS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Hello {{name}},<br/><br/>
Hello,<br/><br/>
{{message|linebreaks}}
<br/><br/>
Thank you,<br/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Hello {{name}},
Hello,

{{message}}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Hello {{name}},<br/><br/>
Hello,<br/><br/>
{{message|linebreaks}}
<br/><br/>
Thank you,<br/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Hello {{name}},
Hello,

{{message}}

Expand Down
11 changes: 6 additions & 5 deletions tests/test_emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
@override_settings(
SSHR_ADMIN_EMAILS=["[email protected]"],
SSHR_ADMIN_LEAVE_EMAILS=["[email protected]"],
SSHR_ADMIN_OVERTIME_EMAILS=["[email protected]"]
SSHR_ADMIN_OVERTIME_EMAILS=["[email protected]"],
SSHR_ADMIN_NAME="mosh"
)
class TestEmails(TestCase):
"""
Expand Down Expand Up @@ -55,7 +56,7 @@ def test_leave_application_email(self, mock):
leave_application_email(leave)

mock.assert_called_with(
name="Bob Ndoe",
name="mosh",
email="[email protected]",
subject="New Leave Application",
message="There has been a new leave application. Please log in to process it.", # noqa
Expand Down Expand Up @@ -104,7 +105,7 @@ def test_overtime_application_email(self, mock):
overtime_application_email(overtime)

mock.assert_called_with(
name="Bob Ndoe",
name="mosh",
email="[email protected]",
subject="New Overtime Application",
message="There has been a new overtime application. Please log in to process it.", # noqa
Expand Down Expand Up @@ -222,7 +223,7 @@ def test_send_email_templates(self, mock, site_mock):
leave_application_email(leave)

context = dict(
name="Bob Ndoe",
name="mosh",
subject="New Leave Application",
message="There has been a new leave application. Please log in to process it.", # noqa
object=leave,
Expand Down Expand Up @@ -260,7 +261,7 @@ def test_send_email_templates(self, mock, site_mock):
overtime_application_email(overtime)

context = dict(
name="Bob Ndoe",
name="mosh",
subject="New Overtime Application",
message="There has been a new overtime application. Please log in to process it.", # noqa
object=overtime,
Expand Down

0 comments on commit d02fc93

Please sign in to comment.