def test_retirement_request_create_success(): """ Ensure that retirement request record creation succeeds. """ user = UserFactory() UserRetirementRequest.create_retirement_request(user) assert UserRetirementRequest.has_user_requested_retirement(user)
def test_retirement_request_create_success(): """ Ensure that retirement request record creation succeeds. """ user = UserFactory() UserRetirementRequest.create_retirement_request(user) assert UserRetirementRequest.has_user_requested_retirement(user)
def test_password_reset_retired_user_fail(self): """ Tests that if a retired user attempts to reset their password, it fails. """ self.assertFalse(self.user.is_active) # Retire the user. UserRetirementRequest.create_retirement_request(self.user) reset_req = self.request_factory.get(self.password_reset_confirm_url) reset_req.user = self.user resp = PasswordResetConfirmWrapper.as_view()(reset_req, uidb36=self.uidb36, token=self.token) # Verify the response status code is: 200 with password reset fail and also verify that # the user is not marked as active. self.assertEqual(resp.status_code, 200) self.assertFalse(User.objects.get(pk=self.user.pk).is_active)
def test_password_reset_retired_user_fail(self): """ Tests that if a retired user attempts to reset their password, it fails. """ self.assertFalse(self.user.is_active) # Retire the user. UserRetirementRequest.create_retirement_request(self.user) url = reverse( 'password_reset_confirm', kwargs={'uidb36': self.uidb36, 'token': self.token} ) reset_req = self.request_factory.get(url) resp = password_reset_confirm_wrapper(reset_req, self.uidb36, self.token) # Verify the response status code is: 200 with password reset fail and also verify that # the user is not marked as active. self.assertEqual(resp.status_code, 200) self.assertFalse(User.objects.get(pk=self.user.pk).is_active)
def test_password_reset_retired_user_fail(self): """ Tests that if a retired user attempts to reset their password, it fails. """ self.assertFalse(self.user.is_active) # Retire the user. UserRetirementRequest.create_retirement_request(self.user) url = reverse( 'password_reset_confirm', kwargs={'uidb36': self.uidb36, 'token': self.token} ) reset_req = self.request_factory.get(url) resp = password_reset_confirm_wrapper(reset_req, self.uidb36, self.token) # Verify the response status code is: 200 with password reset fail and also verify that # the user is not marked as active. self.assertEqual(resp.status_code, 200) self.assertFalse(User.objects.get(pk=self.user.pk).is_active)