Exemplo n.º 1
0
 def test_clean_invite_attendees__invalid(self):
     expected = ['*****@*****.**', 'test@democom']
     data = ','.join(expected)
     org = OrganizationFactory()
     form = EventRegistrationForm(None, org)
     form.cleaned_data = {'invite_attendees': data}
     with self.assertRaises(ValidationError):
         form.clean_invite_attendees()
Exemplo n.º 2
0
 def test_clean_invite_attendees__strip_whitespace(self):
     expected = ['*****@*****.**', '*****@*****.**']
     data = ', '.join(expected)
     org = OrganizationFactory()
     form = EventRegistrationForm(None, org)
     form.cleaned_data = {'invite_attendees': data}
     cleaned = form.clean_invite_attendees()
     self.assertEqual(cleaned, expected)
Exemplo n.º 3
0
 def test_clean_invite_attendees__invalid(self):
     expected = ['*****@*****.**', 'test@democom']
     data = ','.join(expected)
     org = OrganizationFactory()
     form = EventRegistrationForm(None, org)
     form.cleaned_data = {'invite_attendees': data}
     with self.assertRaises(ValidationError):
         form.clean_invite_attendees()
Exemplo n.º 4
0
 def test_clean_invite_attendees__strip_whitespace(self):
     expected = ['*****@*****.**', '*****@*****.**']
     data = ', '.join(expected)
     org = OrganizationFactory()
     form = EventRegistrationForm(None, org)
     form.cleaned_data = {'invite_attendees': data}
     cleaned = form.clean_invite_attendees()
     self.assertEqual(cleaned, expected)
Exemplo n.º 5
0
 def test_attendee_invites_on_save(self):
     emails = ['*****@*****.**', '*****@*****.**']
     event = EventFactory()
     data = model_to_dict(event)
     data['invite_attendees'] = ','.join(emails)
     request = RequestFactory().get('/')
     request.user = PersonFactory()
     form = EventRegistrationForm(request,
                                  event.organization,
                                  instance=event,
                                  data=data)
     self.assertTrue(form.is_valid())
     self.assertTrue(form.cleaned_data.get('invite_attendees'))
     self.assertEqual(EventInvite.get_invites(event).count(), 0)
     self.assertEqual(len(mail.outbox), 0)
     form.save()
     self.assertEqual(EventInvite.get_invites(event).count(), 2)
     self.assertEqual(len(mail.outbox), 2)
Exemplo n.º 6
0
 def test_attendee_invites_on_save(self):
     emails = ['*****@*****.**', '*****@*****.**']
     event = EventFactory()
     data = model_to_dict(event)
     data['invite_attendees'] = ','.join(emails)
     request = RequestFactory().get('/')
     request.user = PersonFactory()
     form = EventRegistrationForm(
         request,
         event.organization,
         instance=event,
         data=data
     )
     self.assertTrue(form.is_valid())
     self.assertTrue(form.cleaned_data.get('invite_attendees'))
     self.assertEqual(EventInvite.get_invites(event).count(), 0)
     self.assertEqual(len(mail.outbox), 0)
     form.save()
     self.assertEqual(EventInvite.get_invites(event).count(), 2)
     self.assertEqual(len(mail.outbox), 2)