'If the course run has opted out of the dynamic deadline, the course mode\'s deadline should be used.'

def test_date_with_self_paced_with_course_opt_out(self):

    course = self.create_self_paced_course_run(days_till_start=(-1))
    DynamicUpgradeDeadlineConfiguration.objects.create(enabled=True)
    CourseDynamicUpgradeDeadlineConfiguration.objects.create(enabled=True, course_id=course.id, opt_out=True)
    enrollment = CourseEnrollmentFactory(course_id=course.id, mode=CourseMode.AUDIT)
    block = VerifiedUpgradeDeadlineDate(course, enrollment.user)
    expected = CourseMode.objects.get(course_id=course.id, mode_slug=CourseMode.VERIFIED).expiration_datetime
    self.assertEqual(block.date, expected)
