'Upload a group avatar.'

def test_upload_avatar(self):

    with open('kitsune/upload/tests/media/test.jpg') as f:
        self.group_profile.avatar.save('test_old.jpg', File(f), save=True)
    assert self.group_profile.avatar.name.endswith('92b516.jpg')
    old_path = self.group_profile.avatar.path
    assert os.path.exists(old_path), 'Old    avatar    is    not    in    place.'
    url = reverse('groups.edit_avatar', locale='en-US', args=[self.group_profile.slug])
    with open('kitsune/upload/tests/media/test.jpg') as f:
        r = self.client.post(url, {'avatar': f})
    eq_(302, r.status_code)
    url = reverse('groups.profile', args=[self.group_profile.slug])
    eq_(('http://testserver/en-US' + url), r['location'])
    assert (not os.path.exists(old_path)), 'Old    avatar    was    not    removed.'
