'Enrolling after a course begins should result in the upgrade deadline being set relative to the
enrollment date.'

def test_date_with_self_paced_with_enrollment_after_course_start(self):

    global_config = DynamicUpgradeDeadlineConfiguration.objects.create(enabled=True)
    course = self.create_self_paced_course_run(days_till_start=(-1))
    enrollment = CourseEnrollmentFactory(course_id=course.id, mode=CourseMode.AUDIT)
    block = VerifiedUpgradeDeadlineDate(course, enrollment.user)
    expected = (enrollment.created + timedelta(days=global_config.deadline_days))
    self.assertEqual(block.date, expected)
    course_config = CourseDynamicUpgradeDeadlineConfiguration.objects.create(enabled=True, course_id=course.id, opt_out=False, deadline_days=3)
    enrollment = CourseEnrollmentFactory(course_id=course.id, mode=CourseMode.AUDIT)
    block = VerifiedUpgradeDeadlineDate(course, enrollment.user)
    expected = (enrollment.created + timedelta(days=course_config.deadline_days))
    self.assertEqual(block.date, expected)
