def METHOD_NAME(self):
    """
    The CourseCodeRedirectView should return a 404 if the course is not published.
    """
    factories.CourseFactory(should_publish=False)
    url = reverse(
        "redirect-course-code-to-course-url", kwargs={"course_code": "00000"}
    )
    request = self.client.get(url, follow=True)
    self.assertEqual(request.status_code, 404)
    # Under the hood, a Http404 exception is raised
    with self.assertRaises(Http404) as context:
        CourseCodeRedirectView().get(request, course_code="00000")
    self.assertEqual(str(context.exception), "No page found for course 00000.")