code: def test_user_update_roles(
      do_client, guest_client, ds_client, root_client, worker
  ):
      # admins can update the roles of lower roles
      clients = [
          get_mock_client(root_client, role) for role in DO_ROLES
      ]
      for c in clients:
          assert worker.root_client.api.services.user.update(
              c.user_id, UserUpdate(role=ServiceRole.ADMIN)
          )
  
      # DOs can update the roles of lower roles
      clients = [
          get_mock_client(root_client, role) for role in DS_ROLES
      ]
      for c in clients:
          assert do_client.api.services.user.update(
              c.user_id, UserUpdate(role=ServiceRole.DATA_SCIENTIST)
          )
  
      clients = [
          get_mock_client(root_client, role) for role in ADMIN_ROLES
      ]
  
      # DOs cannot update roles to greater than / equal to own role
      for c in clients:
          for target_role in [
              ServiceRole.DATA_OWNER,
              ServiceRole.ADMIN,
          ]:
              assert not do_client.api.services.user.update(
                  c.user_id, UserUpdate(role=target_role)
              )
  
      # DOs cannot downgrade higher roles to lower levels
      clients = [
          get_mock_client(root_client, role)
          for role in [ServiceRole.ADMIN, ServiceRole.DATA_OWNER]
      ]
      for c in clients:
          for target_role in DO_ROLES:
              if target_role < c.role:
                  assert not do_client.api.services.user.update(
                      c.user_id, UserUpdate(role=target_role)
                  )
  
      # DSs cannot update any roles
      clients = [
          get_mock_client(root_client, role) for role in ADMIN_ROLES
      ]
      for c in clients:
          for target_role in ADMIN_ROLES:
              assert not ds_client.api.services.user.update(
                  c.user_id, UserUpdate(role=target_role)
              )
  
      # Guests cannot update any roles
      clients = [
          get_mock_client(root_client, role) for role in ADMIN_ROLES
      ]
      for c in clients:
          for target_role in ADMIN_ROLES:
              assert not guest_client.api.services.user.update(
                  c.user_id, UserUpdate(role=target_role)
              )
  
imports: from faker import Faker
  import pytest
  import syft
  from syft import SyftError
  from syft import SyftSuccess
  from syft.client.api import SyftAPICall
  from syft.client.domain_client import DomainClient
  from syft.node.node import get_default_root_email
  from syft.node.worker import Worker
  from syft.service.context import AuthedServiceContext
  from syft.service.user.user import ServiceRole
  from syft.service.user.user import UserCreate
  from syft.service.user.user import UserUpdate
  from syft.service.user.user import UserView
label_desc: Use image node_id 12 for calling a global function with example usage: test_user_update_roles(do_client, guest_client, ds_client, root_client, worker) without return types