Skip to content

Commit ed3e95a

Browse files
committed
test: pytests for requested credits emails
1 parent 0160878 commit ed3e95a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

bc_obps/compliance/tests/test_emails.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,12 @@ def test_obligation_email(self, mock_send_email_to_operators_approved_users_or_r
273273
)
274274

275275
@patch(SEND_EMAIL_OR_RAISE_PATH)
276-
def test_credits_requested_email(self, mock_send_email_or_raise):
276+
def test_credits_requested_email(
277+
self,
278+
mock_send_email_or_raise,
279+
settings,
280+
):
281+
settings.ENVIRONMENT = 'prod'
277282
# Create a report with earned credits
278283
report = baker.make_recipe('reporting.tests.utils.report')
279284
compliance_report = baker.make_recipe('compliance.tests.utils.compliance_report', report=report)
@@ -286,7 +291,7 @@ def test_credits_requested_email(self, mock_send_email_or_raise):
286291
earned_credits_amount=100,
287292
)
288293

289-
template_instance = EmailNotificationTemplateService.get_template_by_name('Notice of Earned Credits Generated')
294+
template_instance = EmailNotificationTemplateService.get_template_by_name('Notice of Credits Requested')
290295
expected_context = {
291296
"operator_legal_name": report.operator.legal_name,
292297
"operation_name": report.operation.name,
@@ -295,5 +300,5 @@ def test_credits_requested_email(self, mock_send_email_or_raise):
295300
# Call the function with the earned credit id
296301
send_notice_of_credits_requested_generated_email(earned_credit.id)
297302
mock_send_email_or_raise.assert_called_once_with(
298-
template_instance, expected_context, ['"ghgregulator@gov.bc.ca"']
303+
template_instance, expected_context, ['GHGRegulator@gov.bc.ca']
299304
)

0 commit comments

Comments
 (0)