Example #1
0
def create_users(team, event):
    """
        Create or get User objects based on team list
    """
    members = []
    for member in team:
        member["event"] = event.pk
        form = AddOrganizerForm(data=member)
        user = form.save()
        members.append(user)
    return members
def create_users(team, event):
    """
        Create or get User objects based on team list
    """
    members = []
    for member in team:
        member['event'] = event.pk
        form = AddOrganizerForm(member)
        user = form.save()
        members.append(user)
    return members
Example #3
0
def test_name_splitting(future_event):
    form = AddOrganizerForm({
        'event': future_event.pk,
        'email': '*****@*****.**',
        'name': 'Olaf Olaffson'
    })

    assert form.is_valid()
    organizer = form.save()
    assert organizer.first_name == 'Olaf'
    assert organizer.last_name == 'Olaffson'
Example #4
0
def test_name_splitting(future_event):
    form = AddOrganizerForm({
        'event': future_event.pk,
        'email': '*****@*****.**',
        'name': 'Olaf Olaffson'
    })

    assert form.is_valid()
    organizer = form.save()
    assert organizer.first_name == 'Olaf'
    assert organizer.last_name == 'Olaffson'
Example #5
0
    def test_name_splitting(self):
        event = Event.objects.first()
        form = AddOrganizerForm({
            'event': event.pk,
            'email': '*****@*****.**',
            'name': 'Olaf Olaffson'
        })

        self.assertTrue(form.is_valid())
        organizer = form.save()
        self.assertEqual(organizer.first_name, 'Olaf')
        self.assertEqual(organizer.last_name, 'Olaffson')