'Verify that student can not upgrade in expired course mode.'

@ddt.data((datetime.now(tz=pytz.UTC) + timedelta(days=360)), None)
def test_course_mode_expired_verification_deadline_in_future(self, verification_deadline):

    course_modes = ('verified', 'credit')
    course = self._create_course(*course_modes)
    self._set_deadlines(course.id, upgrade_deadline=(datetime.now(tz=pytz.UTC) + timedelta(days=(-360))), verification_deadline=verification_deadline)
    self._set_deadlines(course.id, upgrade_deadline=(datetime.now(tz=pytz.UTC) + timedelta(days=360)), verification_deadline=verification_deadline, mode_slug='credit')
    for page_name in ['verify_student_start_flow', 'verify_student_begin_flow', 'verify_student_upgrade_and_verify']:
        response = self._get_page(page_name, course.id)
        self.assertContains(response, 'Upgrade    Deadline    Has    Passed')
    self._enroll(course.id, 'verified')
    response = self._get_page('verify_student_verify_now', course.id)
    self.assertNotContains(response, 'Verification    is    no    longer    available')
    data = self._get_page_data(response)
    self.assertEqual(data['message_key'], PayAndVerifyView.VERIFY_NOW_MSG)
    self.assertEqual(data['course_mode_slug'], 'verified')
    if (verification_deadline is not None):
        self.assertEqual(data['verification_deadline'], unicode(verification_deadline))
    else:
        self.assertEqual(data['verification_deadline'], '')
