util.tests.test_email_serviceΒΆ

Tests for util/email_service.py.

ClassesΒΆ

TestEmailService

Tests for EmailService class.

FunctionsΒΆ

locmem_email_backend(settings)

Force Django to use locmem email backend for tests.

templates_dir(settings, tmp_path)

Provide a clean temporary template directory and point Django to it.

_write_template(tpldir, relpath, content)

Helper to create a template file with given relative path and content.

Module ContentsΒΆ

util.tests.test_email_service.locmem_email_backend(settings)[source]ΒΆ

Force Django to use locmem email backend for tests.

Parameters:

settings (Any)

Return type:

None

util.tests.test_email_service.templates_dir(settings, tmp_path)[source]ΒΆ

Provide a clean temporary template directory and point Django to it.

Parameters:
  • settings (Any)

  • tmp_path (Any)

Return type:

Any

util.tests.test_email_service._write_template(tpldir, relpath, content)[source]ΒΆ

Helper to create a template file with given relative path and content.

Parameters:
  • tpldir (Any)

  • relpath (str)

  • content (str)

Return type:

None

class util.tests.test_email_service.TestEmailService[source]ΒΆ

Tests for EmailService class.

test_send_email_basic(templates_dir)[source]ΒΆ

Test sending a basic email.

Parameters:

templates_dir (Any)

Return type:

None

test_send_email_with_custom_from(templates_dir)[source]ΒΆ

Test sending email with custom from_email.

Parameters:

templates_dir (Any)

Return type:

None

test_send_email_with_default_from(templates_dir, settings)[source]ΒΆ

Test sending email with default from_email from settings.

Parameters:
  • templates_dir (Any)

  • settings (Any)

Return type:

None

test_send_email_with_cc(templates_dir)[source]ΒΆ

Test sending email with CC recipients.

Parameters:

templates_dir (Any)

Return type:

None

test_send_email_with_bcc(templates_dir)[source]ΒΆ

Test sending email with BCC recipients.

Parameters:

templates_dir (Any)

Return type:

None

test_send_email_with_cc_and_bcc(templates_dir)[source]ΒΆ

Test sending email with both CC and BCC recipients.

Parameters:

templates_dir (Any)

Return type:

None

test_send_email_with_attachments(templates_dir)[source]ΒΆ

Test sending email with attachments.

Parameters:

templates_dir (Any)

Return type:

None

test_send_email_with_multiple_attachments(templates_dir)[source]ΒΆ

Test sending email with multiple attachments.

Parameters:

templates_dir (Any)

Return type:

None

test_send_email_to_multiple_recipients(templates_dir)[source]ΒΆ

Test sending email to multiple recipients.

Parameters:

templates_dir (Any)

Return type:

None

test_send_email_with_complex_context(templates_dir)[source]ΒΆ

Test sending email with complex context variables.

Parameters:

templates_dir (Any)

Return type:

None

test_send_email_empty_context(templates_dir)[source]ΒΆ

Test sending email with empty context.

Parameters:

templates_dir (Any)

Return type:

None

test_send_email_none_cc_and_bcc(templates_dir)[source]ΒΆ

Test that None CC and BCC are handled as empty lists.

Parameters:

templates_dir (Any)

Return type:

None

test_send_email_none_attachments(templates_dir)[source]ΒΆ

Test that None attachments are handled correctly.

Parameters:

templates_dir (Any)

Return type:

None

test_send_email_logs_info(mock_logger, templates_dir)[source]ΒΆ

Test that sending email logs an info message.

Parameters:
  • mock_logger (unittest.mock.Mock)

  • templates_dir (Any)

Return type:

None

test_send_email_logs_multiple_recipients(mock_logger, templates_dir)[source]ΒΆ

Test that logging includes all recipients.

Parameters:
  • mock_logger (unittest.mock.Mock)

  • templates_dir (Any)

Return type:

None

test_send_email_template_rendering(templates_dir)[source]ΒΆ

Test that templates are rendered correctly with context.

Parameters:

templates_dir (Any)

Return type:

None

test_send_email_fail_silently_false(templates_dir)[source]ΒΆ

Test that send is called with fail_silently=False.

Parameters:

templates_dir (Any)

Return type:

None

test_send_email_special_characters_in_subject(templates_dir)[source]ΒΆ

Test sending email with special characters in subject.

Parameters:

templates_dir (Any)

Return type:

None

test_send_email_unicode_in_templates(templates_dir)[source]ΒΆ

Test sending email with Unicode characters in templates.

Parameters:

templates_dir (Any)

Return type:

None