Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into NotSpecial-patch-3
Browse files Browse the repository at this point in the history
  • Loading branch information
temparus authored Dec 17, 2023
2 parents 0f2fec1 + 2cbe03f commit 8bd9cdb
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
6 changes: 4 additions & 2 deletions amivapi/templates/events_accept.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{% block text_german %}
<p>Hallo {{ name }}!</p>
<p>Wir freuen uns, dir mitteilen zu können, dass deine Anmeldung für {{ title_de }} angenommen wurde und du an der Veranstaltung teilnehmen kannst!</p>
<p>Wenn du nicht mehr an der Veranstaltung teilnehmen kannst, melde dich <a href="{{ link }}">hier</a> ab, um deinen Platz für jemand anderen freizugeben.<br/>
<p>Wenn du nicht mehr an der Veranstaltung teilnehmen kannst, melde dich ab, um deinen Platz für jemand anderen freizugeben.<br/>
<b>Drücke hier, um dich direkt abzumelden:<a href="{{ link }}">Abmelden!</a> </b>
Du kannst dich nur bis {{ weekdays_de[deadline.weekday()] }}, {{ deadline.strftime('%d.%m.%Y %H:%I') }} vom Event abmelden.</p>
{% if signup_additional_info_de is not none and signup_additional_info_de|length %}
<p>{{ signup_additional_info_de }}</p>
Expand All @@ -17,7 +18,8 @@
{% block text_english %}
<p>Hello {{ name }}!</p>
<p>We are happy to inform you that your signup for {{ title_en }} was accepted and you can come to the event!</p>
<p>If you do not have time to attend the event please click <a href="{{ link }}">here</a> to free your spot for someone else.<br/>
<p>If you do not have time to attend the event please free your spot for someone else.<br/>
<b>Click here to signoff directly:<a href="{{ link }}">Signoff!</a> </b>
You cannot sign out of this event after {{ weekdays_en[deadline.weekday()] }}, {{ deadline.strftime('%d.%m.%Y %H:%I') }}.</p>
{% if signup_additional_info_en is not none and signup_additional_info_en|length %}
<p>{{ signup_additional_info_en }}</p>
Expand Down
47 changes: 47 additions & 0 deletions amivapi/tests/events/test_emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,53 @@ def test_no_nones_in_emails(self):
for field in mail.values():
self.assertTrue('None' not in field)

def test_signup_added_by_admin_accepted_emails(self):
"""Test that an accepted email is sent when an admin has added a
signup manually."""
event = self.new_object('events', spots=1, selection_strategy='fcfs',
allow_email_signup=True)

user = self.new_object('users')

self.api.post('/eventsignups', data={
'user': str(user['_id']),
'event': str(event['_id']),
'accepted': True
}, token=self.get_root_token(), status_code=201).json

mail = self.app.test_mails[0]
for field in mail.values():
# We check whether any field in the email structure contains the
# string 'None' as this is the string representation of the None
# value. This happens when a value inserted into the template
# string was (unexpectedly) None.
self.assertTrue('None' not in field)

self.assertTrue('accepted' in mail['subject'])

self.api.post('/eventsignups', data={
'email': '[email protected]',
'event': str(event['_id']),
'accepted': True
}, token=self.get_root_token(), status_code=201).json

# accepted email and confirmation email should be sent.
self.assertIs(len(self.app.test_mails), 3)
for mail in self.app.test_mails[1:]:
for field in mail.values():
# We check whether any field in the email structure contains the
# string 'None' as this is the string representation of the None
# value. This happens when a value inserted into the template
# string was (unexpectedly) None.
self.assertTrue('None' not in field)

# We expect that the accepted email and the email to confirm the
# email address were sent.
# We check some unique phrases distinct to each of these messages.
self.assertTrue(
('accepted' in mail['subject']) !=
('confirm_email' in mail['text']))

def test_calendar_invite_format(self):
"""Test that the calendar invite format.
Specifically looks for the correct line format and the presence of
Expand Down

0 comments on commit 8bd9cdb

Please sign in to comment.