'Make sure password are viewed as expired in LMS after the policy time has elapsed'

@patch.dict('django.conf.settings.ADVANCED_SECURITY_CONFIG', {'MIN_DAYS_FOR_STAFF_ACCOUNTS_PASSWORD_RESETS': 1})
@patch.dict('django.conf.settings.ADVANCED_SECURITY_CONFIG', {'MIN_DAYS_FOR_STUDENT_ACCOUNTS_PASSWORD_RESETS': 5})
def test_forced_password_change(self):

    (student_email, student_password) = self._setup_user()
    (staff_email, staff_password) = self._setup_user(is_staff=True)
    self._login(student_email, student_password)
    self._login(staff_email, staff_password)
    staff_reset_time = (timezone.now() + timedelta(days=1))
    with freeze_time(staff_reset_time):
        self._login(student_email, student_password)
        self._login(staff_email, staff_password, should_succeed=False, err_msg_check='Your    password    has    expired    due    to    password    policy    on    this    account')
        self._update_password(staff_email, 'updated')
        self._login(staff_email, 'updated')
    student_reset_time = (timezone.now() + timedelta(days=5))
    with freeze_time(student_reset_time):
        self._login(student_email, student_password, should_succeed=False, err_msg_check='Your    password    has    expired    due    to    password    policy    on    this    account')
        self._update_password(student_email, 'updated')
        self._login(student_email, 'updated')
        self._login(staff_email, staff_password, should_succeed=False, err_msg_check='Your    password    has    expired    due    to    password    policy    on    this    account')
        self._update_password(staff_email, 'updated2')
        self._login(staff_email, 'updated2')
