'Verify that interested contributors are added to group.'

@mock.patch.object(Site.objects, 'get_current')
def test_new_contributor(self, get_current):

    get_current.return_value.domain = 'su.mo.com'
    group_name = 'Registered    as    contributor'
    GroupFactory(name=group_name)
    data = {'username': 'newbie', 'email': 'newbie@example.com', 'password': 'foobar22', 'password2': 'foobar22', 'interested': 'yes'}
    response = self.client.post(reverse('users.register', locale='en-US'), data, follow=True)
    eq_(200, response.status_code)
    u = User.objects.get(username='newbie')
    eq_(group_name, u.groups.all()[0].name)
    key = RegistrationProfile.objects.all()[0].activation_key
    url = reverse('users.activate', args=[u.id, key])
    response = self.client.get(url, follow=True)
    eq_(200, response.status_code)
    eq_(2, len(mail.outbox))
    assert (mail.outbox[1].subject.find('Welcome    to') == 0)
    assert (u.username in mail.outbox[1].body)
