'Call `add_users_to_cohort` for a given cohort, course, and list of
users, returning its response as a dict.  When `should_raise_404` is
True, verify that the request raised a Http404.'

def request_add_users_to_cohort(self, users_string, cohort, course, should_raise_404=False):

    request = RequestFactory().post('dummy_url', {'users': users_string})
    request.user = self.staff_user
    if should_raise_404:
        self.assertRaises(Http404, (lambda : add_users_to_cohort(request, unicode(course.id), cohort.id)))
    else:
        response = add_users_to_cohort(request, unicode(course.id), cohort.id)
        self.assertEqual(response.status_code, 200)
        return json.loads(response.content)
