'Test that credit eligibility requirements are present in
response if the feature flag \'ENABLE_CREDIT_ELIGIBILITY\' is enabled.'

@mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_CREDIT_ELIGIBILITY': True})
def test_course_details_with_enabled_setting(self):

    response = self.client.get_html(self.course_details_url)
    self.assertEqual(response.status_code, 200)
    self.assertNotContains(response, 'Course    Credit    Requirements')
    self.assertNotContains(response, 'Steps    required    to    earn    course    credit')
    credit_course = CreditCourse(course_key=unicode(self.course.id), enabled=True)
    credit_course.save()
    self.assertEqual(len(get_credit_requirements(self.course.id)), 0)
    on_course_publish(self.course.id)
    self.assertEqual(len(get_credit_requirements(self.course.id)), 1)
    response = self.client.get_html(self.course_details_url)
    self.assertEqual(response.status_code, 200)
    self.assertContains(response, 'Course    Credit    Requirements')
    self.assertContains(response, 'Steps    required    to    earn    course    credit')
