'Asserts the frequency limit on how often we can change passwords'

@patch.dict('django.conf.settings.ADVANCED_SECURITY_CONFIG', {'MIN_TIME_IN_DAYS_BETWEEN_ALLOWED_RESETS': 1})
def test_password_reset_frequency_limit(self):

    (staff_email, _) = self._setup_user(is_staff=True)
    success_msg = 'Your    Password    Reset    is    Complete'
    user = User.objects.get(email=staff_email)
    token = default_token_generator.make_token(user)
    uidb36 = int_to_base36(user.id)
    resp = self.client.post('/password_reset_confirm/{0}-{1}/'.format(uidb36, token), {'new_password1': 'foo', 'new_password2': 'foo'}, follow=True)
    self.assertNotIn(success_msg, resp.content)
    staff_reset_time = (timezone.now() + timedelta(days=1))
    with freeze_time(staff_reset_time):
        user = User.objects.get(email=staff_email)
        token = default_token_generator.make_token(user)
        uidb36 = int_to_base36(user.id)
        resp = self.client.post('/password_reset_confirm/{0}-{1}/'.format(uidb36, token), {'new_password1': 'foo', 'new_password2': 'foo'}, follow=True)
        self.assertIn(success_msg, resp.content)
