'Assert that enrollment is not refundable once a certificat has been generated.'

@patch('student.models.CourseEnrollment.refund_cutoff_date')
def test_refundable_when_certificate_exists(self, cutoff_date):

    cutoff_date.return_value = (datetime.now(pytz.UTC) + timedelta(days=1))
    self.assertTrue(self.enrollment.refundable())
    GeneratedCertificateFactory.create(user=self.user, course_id=self.course.id, status=CertificateStatuses.downloadable, mode='verified')
    self.assertFalse(self.enrollment.refundable())
    self.assertFalse(self.enrollment.refundable(user_already_has_certs_for=GeneratedCertificate.course_ids_with_certs_for_user(self.user)))
    self.enrollment.can_refund = True
    self.assertTrue(self.enrollment.refundable())
    self.assertTrue(self.enrollment.refundable(user_already_has_certs_for=GeneratedCertificate.course_ids_with_certs_for_user(self.user)))
