'The property should use either the CourseMode or related Schedule to determine the deadline.'

@skip_unless_lms
@factory.django.mute_signals(signals.post_save)
def test_upgrade_deadline(self):

    course_mode = CourseModeFactory(course_id=self.course.id, mode_slug=CourseMode.VERIFIED, expiration_datetime=(datetime.datetime.now(pytz.UTC) + datetime.timedelta(days=1)))
    enrollment = CourseEnrollmentFactory(course_id=self.course.id, mode=CourseMode.AUDIT)
    self.assertEqual(Schedule.objects.all().count(), 0)
    self.assertEqual(enrollment.upgrade_deadline, course_mode.expiration_datetime)
    schedule = ScheduleFactory(enrollment=enrollment)
    self.assertEqual(enrollment.upgrade_deadline, schedule.upgrade_deadline)
