'Tests inviting a registered user'

def test_invite_user(self):

    normal = get_user_model().objects.get(username='norman')
    admin = get_user_model().objects.get(username='admin')
    group = GroupProfile.objects.get(slug='bar')
    group.invite(normal, admin, role='member', send=False)
    self.assert_(GroupInvitation.objects.filter(user=normal, from_user=admin, group=group).exists())
    invite = GroupInvitation.objects.get(user=normal, from_user=admin, group=group)
    self.client.login(username='norman', password='norman')
    response = self.client.get('/groups/group/{group}/invite/{token}/'.format(group=group, token=invite.token))
    self.assertEqual(200, response.status_code)
