UPD: dav_registration: improved tests.
This commit is contained in:
@@ -8,7 +8,7 @@ Referenz-Nr: {{ registration.id }}
|
||||
|
||||
Teilnehmer*in:
|
||||
{{ registration.get_full_name }}
|
||||
{{ registration.address }},{{ registration.postal_code }} {{ registration.city }}
|
||||
{{ registration.address }}, {{ registration.postal_code }} {{ registration.city }}
|
||||
{{ registration.phone_number }}
|
||||
{{ registration.email_address }}
|
||||
{{ registration.dav_number }}
|
||||
|
||||
@@ -63,7 +63,7 @@ Referenz-Nr: {registration_id}
|
||||
|
||||
Teilnehmer*in:
|
||||
{participant_full_name}
|
||||
,
|
||||
,
|
||||
|
||||
{participant_email}
|
||||
|
||||
@@ -97,7 +97,7 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
|
||||
self.accept_event(self.event)
|
||||
self.confirm_publication_event(self.event)
|
||||
|
||||
def test_email_self(self):
|
||||
def test_email_self_minimum_data(self):
|
||||
event = self.event
|
||||
trainer = event.owner
|
||||
registration_data = {
|
||||
@@ -129,12 +129,70 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
|
||||
trainer_full_name=trainer.get_full_name(),
|
||||
trainer_first_name=trainer.first_name,
|
||||
registration_id=registration.id,
|
||||
registration_at=format_datetime(registration.created_at, 'EEEE, dd. MMMM yyyy, HH:mm', locale=locale),
|
||||
registration_at=format_datetime(registration.created_at, 'EEEE, dd. MMMM yyyy, H:mm', locale=locale),
|
||||
purge_at=format_datetime(registration.purge_at, 'EEEE, dd. MMMM yyyy', locale=locale),
|
||||
)
|
||||
self.assertBody(mail, body)
|
||||
|
||||
def test_email_trainer(self):
|
||||
def test_email_self_full_data(self):
|
||||
event = self.event
|
||||
registration_data = {
|
||||
'event': event,
|
||||
'personal_names': 'Participant',
|
||||
'family_names': 'One',
|
||||
'email_address': 'participant@localhost',
|
||||
'address': 'Am Fächerbad 2',
|
||||
'postal_code': '76131',
|
||||
'city': 'Karlsruhe',
|
||||
'phone_number': '+49 721 1234567890 AB (Büro)',
|
||||
'dav_number': '131/00/007*12345',
|
||||
'emergency_contact': 'Call 911!',
|
||||
'experience': 'Yes, we can!',
|
||||
'note': 'Automatischer Software Test\nGruß\n heinzel =u}',
|
||||
'privacy_policy': 'Du willst es doch auch.',
|
||||
}
|
||||
self.create_registration(registration_data)
|
||||
mail = django_mail.outbox[1]
|
||||
|
||||
search = '\n'
|
||||
search += 'Personendaten\n'
|
||||
search += '-------------\n'
|
||||
search += '{} {}\n'.format(registration_data['personal_names'], registration_data['family_names'])
|
||||
search += '{}\n'.format(registration_data['address'])
|
||||
search += '{} {}\n'.format(registration_data['postal_code'], registration_data['city'])
|
||||
search += 'Telefon: {}\n'.format(registration_data['phone_number'])
|
||||
search += 'E-Mail: {}\n'.format(registration_data['email_address'])
|
||||
search += 'DAV Mitgliedsnummer: {}\n'.format(registration_data['dav_number'])
|
||||
self.assertIn(search, mail.body)
|
||||
|
||||
search = '\n'
|
||||
search += 'Notfall-Kontakt\n'
|
||||
search += '---------------\n'
|
||||
search += registration_data['emergency_contact']
|
||||
search += '\n'
|
||||
self.assertIn(search, mail.body)
|
||||
|
||||
search = '\n'
|
||||
search += 'Erfahrung\n'
|
||||
search += '---------\n'
|
||||
search += registration_data['experience']
|
||||
search += '\n'
|
||||
self.assertIn(search, mail.body)
|
||||
|
||||
search = '\n'
|
||||
search += 'Anmerkung\n'
|
||||
search += '---------\n'
|
||||
search += registration_data['note']
|
||||
search += '\n'
|
||||
self.assertIn(search, mail.body)
|
||||
|
||||
search = '\n'
|
||||
search += registration_data['privacy_policy']
|
||||
search += '\n'
|
||||
search += 'Zeitpunkt der Datenlöschung:'
|
||||
self.assertIn(search, mail.body)
|
||||
|
||||
def test_email_trainer_minimum_data(self):
|
||||
event = self.event
|
||||
trainer = event.owner
|
||||
registration_data = {
|
||||
@@ -166,7 +224,64 @@ class EmailsTestCase(EmailTestMixin, EventMixin, RegistrationMixin, TestCase):
|
||||
event_formated_date=event.get_formated_date(),
|
||||
trainer_first_name=trainer.first_name,
|
||||
registration_id=registration.id,
|
||||
registration_at=format_datetime(registration.created_at, 'EEEE, dd. MMMM yyyy, HH:mm', locale=locale),
|
||||
registration_at=format_datetime(registration.created_at, 'EEEE, dd. MMMM yyyy, H:mm', locale=locale),
|
||||
purge_at=format_datetime(registration.purge_at, 'EEEE, dd. MMMM yyyy', locale=locale),
|
||||
)
|
||||
self.assertBody(mail, body)
|
||||
|
||||
def test_email_trainer_full_data(self):
|
||||
event = self.event
|
||||
registration_data = {
|
||||
'event': event,
|
||||
'personal_names': 'Participant',
|
||||
'family_names': 'One',
|
||||
'email_address': 'participant@localhost',
|
||||
'address': 'Am Fächerbad 2',
|
||||
'postal_code': '76131',
|
||||
'city': 'Karlsruhe',
|
||||
'phone_number': '+49 721 1234567890 AB (Büro)',
|
||||
'dav_number': '131/00/007*12345',
|
||||
'emergency_contact': 'Call 911!',
|
||||
'experience': 'Yes, we can!',
|
||||
'note': 'Automatischer Software Test\nGruß\n heinzel =u}',
|
||||
'privacy_policy': 'Du willst es doch auch.',
|
||||
}
|
||||
self.create_registration(registration_data)
|
||||
mail = django_mail.outbox[0]
|
||||
|
||||
search = '\n'
|
||||
search += '{address}, {code} {city}'.format(address=registration_data['address'],
|
||||
code=registration_data['postal_code'],
|
||||
city=registration_data['city'])
|
||||
search += '\n'
|
||||
search += registration_data['phone_number']
|
||||
search += '\n'
|
||||
search += registration_data['email_address']
|
||||
search += '\n'
|
||||
search += registration_data['dav_number']
|
||||
search += '\n'
|
||||
self.assertIn(search, mail.body)
|
||||
|
||||
search = '\n'
|
||||
search += 'Notfall-Kontakt:\n'
|
||||
search += registration_data['emergency_contact']
|
||||
search += '\n'
|
||||
self.assertIn(search, mail.body)
|
||||
|
||||
search = '\n'
|
||||
search += 'Erfahrung:\n'
|
||||
search += registration_data['experience']
|
||||
search += '\n'
|
||||
self.assertIn(search, mail.body)
|
||||
|
||||
search = '\n'
|
||||
search += 'Anmerkung:\n'
|
||||
search += registration_data['note']
|
||||
search += '\n'
|
||||
self.assertIn(search, mail.body)
|
||||
|
||||
search = '\n'
|
||||
search += registration_data['privacy_policy']
|
||||
search += '\n'
|
||||
search += 'Zeitpunkt der Datenlöschung:'
|
||||
self.assertIn(search, mail.body)
|
||||
|
||||
Reference in New Issue
Block a user