def test_api_permission_user_granted_permission(self):
        user = UserFactory()
        self.request.user = user

        with self.settings(RETIREMENT_SERVICE_WORKER_USERNAME=user.username):
            result = CanRetireUser().has_permission(self.request, None)
            self.assertTrue(result)
 def test_api_permission_user_without_permission(self):
     self.request.user = UserFactory()
     result = CanRetireUser().has_permission(self.request, None)
     self.assertFalse(result)
    def test_api_permission_superuser(self):
        self.request.user = SuperuserFactory()

        result = CanRetireUser().has_permission(self.request, None)
        self.assertTrue(result)