Skip to content

Commit

Permalink
Add email livereload, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
blopker committed Aug 7, 2024
1 parent 774b885 commit bbfb11f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 4 additions & 3 deletions totem/email/templates/email/email_viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
<hr />
<h2>Text</h2>
{{ text }}
{% if debug %}
<script>
document.write(
'<script src="http://' +
(location.host || "localhost").split(":")[0] +
':35729/livereload.js?snipver=1"></' +
"<" +
'script src="http://localhost:35729/livereload.js?snipver=1"></' +
"script>"
)
</script>
{% endif %}
11 changes: 11 additions & 0 deletions totem/email/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,14 @@ def test_returning_users(self, client, db):
assert email.to == [user.email]
message = str(email.message())
assert "http://testserver/" in message

def test_returning_users_after_login(self, client, db):
user = UserFactory()
user.save()
client.force_login(user)
send_returning_login_email(user.email, reverse("pages:home"))
assert len(mail.outbox) == 1
email = mail.outbox[0]
assert email.to == [user.email]
message = str(email.message())
assert "http://testserver/" in message

0 comments on commit bbfb11f

Please sign in to comment.