'Retrieve the cross-domain CSRF cookie.'

def _get_csrf_cookie(self):

    url = reverse('courseenrollment', kwargs={'course_id': unicode(self.course.id)})
    resp = self.client.get(url, HTTP_REFERER=self.REFERER)
    self.assertEqual(resp.status_code, 200)
    self.assertIn('prod-edx-csrftoken', resp.cookies)
    return resp.cookies['prod-edx-csrftoken'].value
