Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added docs about testing HTML email content #18273

Closed

Conversation

GitRon
Copy link
Contributor

@GitRon GitRon commented Jun 14, 2024

Trac ticket number

ticket-XXXXX

https://forum.djangoproject.com/t/improve-email-unit-testing/32044/2

Branch description

Added docs about testing HTML email content.

Checklist

  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number, and ends with a period.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • I have attached screenshots in both light and dark modes for any UI changes.

@GitRon
Copy link
Contributor Author

GitRon commented Jun 14, 2024

Hi @sarahboyce! I tried my best, working in plain text files with zero syntax support feels... uncomfortable 😅 No idea if I screwed up somewhere. I'd be happy for some feedback and guidance if I'm on the right track 🙂

Best regards
Ronny

Copy link
Contributor

@sarahboyce sarahboyce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I have minor comments 👍

docs/topics/testing/tools.txt Show resolved Hide resolved
docs/topics/testing/tools.txt Outdated Show resolved Hide resolved
docs/topics/testing/tools.txt Outdated Show resolved Hide resolved
docs/topics/testing/tools.txt Outdated Show resolved Hide resolved
@GitRon
Copy link
Contributor Author

GitRon commented Jun 14, 2024

@sarahboyce Thx so much for the review 💪 Applied all your suggestions.

@GitRon GitRon marked this pull request as ready for review June 14, 2024 13:17

# Verify that the HTML content for the first message is correct.
self.assertEqual(
mail.outbox[0].alternatives[0][0], "<strong>Here is the message.</strong>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth flagging this conflicts with #18261 slightly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx @RealOrangeOne! What would be the default process in this case? see which PR makes it in faster and adjust the other afterwards?

Copy link
Contributor

@sarahboyce sarahboyce Jun 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it conflicts too much, I think they roughly compliment each other 👍

#18261 needs an accepted ticket and then docs, release note etc
@RealOrangeOne I'd invite you to add your thoughts on https://forum.djangoproject.com/t/improve-email-unit-testing/32044/2 as this is a topic along the lines of "can we make testing emails a bit nicer" and your PR looks related to this as a goal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx @sarahboyce! What's the next action? Let it sit here for a while so others can add their opinion?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I squashed and tweaked the test (I reduced some of the asserts as they exist above but can add them in if wanted).
Would like an approval from someone other than me before merging 👍 (maybe from @nessita when she's back)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for summoning me! I agree with the resolution of this PR.

@sarahboyce sarahboyce force-pushed the feature/email-testing-docs-for-html-emails branch 2 times, most recently from 2c01406 to 2af05ae Compare June 14, 2024 15:17
…ves message.

It is common that emails have an alternative HTML part attached. This test shows
how you can assert this content.
@sarahboyce sarahboyce force-pushed the feature/email-testing-docs-for-html-emails branch from 2af05ae to 9721f9d Compare June 14, 2024 15:23
@GitRon
Copy link
Contributor Author

GitRon commented Jun 21, 2024

Hi @sarahboyce

do you think this PR has still value after the other, releated PRs?

Best
Ronny

@sarahboyce
Copy link
Contributor

Hi @sarahboyce

do you think this PR has still value after the other, releated PRs?

Best Ronny

I think because the new attributes have examples around testing, probably not 🤔

@GitRon
Copy link
Contributor Author

GitRon commented Jun 21, 2024

I think because the new attributes have examples around testing, probably not 🤔

Ok, was at least not too much work.

@GitRon GitRon closed this Jun 21, 2024
@GitRon GitRon deleted the feature/email-testing-docs-for-html-emails branch June 21, 2024 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants