code: def test_model_rbac_deletes() -> None:
      with create_workspaces_with_users(
          [
              [
                  (0, ["Editor"]),
              ],
          ]
      ) as (workspaces, creds):
          workspace_id = workspaces[0].id
          # create non-cluster admin user
          editor_creds = creds[0]
          editor_session = api_utils.determined_test_session(
              editor_creds
          )
  
          # create cluster admin user
          cluster_admin_creds = api_utils.create_test_user(
              add_password=True,
              user=bindings.v1User(
                  username=get_random_string(), active=True, admin=False
              ),
          )
          api_utils.assign_user_role(
              session=api_utils.determined_test_session(
                  conf.ADMIN_CREDENTIALS
              ),
              user=cluster_admin_creds.username,
              role="ClusterAdmin",
              workspace=None,
          )
          cluster_admin_session = api_utils.determined_test_session(
              cluster_admin_creds
          )
  
          # create non-cluster admin user with OSS admin flag
          oss_admin_creds = api_utils.create_test_user(
              add_password=True,
              user=bindings.v1User(
                  username=get_random_string(), active=True, admin=True
              ),
          )
          oss_admin_session = api_utils.determined_test_session(
              oss_admin_creds
          )
  
          model_num = 0
          try:
              # test deleting model registries
              tests: List[Dict[str, Any]] = [
                  {
                      "create_session": cluster_admin_session,
                      "delete_session": cluster_admin_session,
                      "should_error": False,
                  },
                  {
                      "create_session": editor_session,
                      "delete_session": cluster_admin_session,
                      "should_error": False,
                  },
                  {
                      "create_session": editor_session,
                      "delete_session": editor_session,
                      "should_error": False,
                  },
                  {
                      "create_session": cluster_admin_session,
                      "delete_session": editor_session,
                      "should_error": True,
                  },
                  {
                      "create_session": cluster_admin_session,
                      "delete_session": oss_admin_session,
                      "should_error": True,
                  },
              ]
              for t in tests:
                  create_session: Session = t["create_session"]
                  delete_session: Session = t["delete_session"]
                  should_error: bool = t["should_error"]
  
                  model_name = "model_" + str(model_num)
                  model_num += 1
                  create_model_registry(
                      create_session, model_name, workspace_id
                  )
  
                  if should_error:
                      with pytest.raises(
                          errors.ForbiddenException
                      ) as permErr:
                          bindings.delete_DeleteModel(
                              delete_session, modelName=model_name
                          )
                      assert "access denied" in str(permErr.value)
                  else:
                      bindings.delete_DeleteModel(
                          delete_session, modelName=model_name
                      )
                      with pytest.raises(
                          errors.NotFoundException
                      ) as notFoundErr:
                          bindings.get_GetModel(
                              create_session, modelName=model_name
                          )
                      assert (
                          "not found" in str(notFoundErr.value).lower()
                      )
  
              # test deleting model versions
              tests = [
                  {
                      "create_creds": cluster_admin_creds,
                      "delete_session": cluster_admin_session,
                      "should_error": False,
                  },
                  {
                      "create_creds": editor_creds,
                      "delete_session": editor_session,
                      "should_error": False,
                  },
                  {
                      "create_creds": editor_creds,
                      "delete_session": cluster_admin_session,
                      "should_error": False,
                  },
                  {
                      "create_creds": cluster_admin_creds,
                      "delete_session": editor_session,
                      "should_error": True,
                  },
                  {
                      "create_creds": cluster_admin_creds,
                      "delete_session": oss_admin_session,
                      "should_error": True,
                  },
              ]
  
              for t in tests:
                  create_creds: authentication.Credentials = t[
                      "create_creds"
                  ]
                  delete_session = t["delete_session"]
                  should_error = t["should_error"]
  
                  model_name = "model_" + str(model_num)
                  model_num += 1
                  m, ca_model_version = register_model_version(
                      creds=create_creds,
                      model_name=model_name,
                      workspace_id=workspace_id,
                  )
                  model_version_num = ca_model_version.model_version
  
                  if should_error:
                      with pytest.raises(
                          errors.ForbiddenException
                      ) as permErr:
                          bindings.delete_DeleteModelVersion(
                              delete_session,
                              modelName=model_name,
                              modelVersionNum=model_version_num,
                          )
                      assert "access denied" in str(permErr.value)
                  else:
                      bindings.delete_DeleteModelVersion(
                          delete_session,
                          modelName=model_name,
                          modelVersionNum=model_version_num,
                      )
                      with pytest.raises(
                          errors.NotFoundException
                      ) as notFoundErr:
                          bindings.get_GetModelVersion(
                              api_utils.determined_test_session(
                                  create_creds
                              ),
                              modelName=model_name,
                              modelVersionNum=model_version_num,
                          )
                      assert (
                          "not found" in str(notFoundErr.value).lower()
                      )
          finally:
              for i in range(model_num):
                  admin_session = api_utils.determined_test_session(
                      conf.ADMIN_CREDENTIALS
                  )
                  try:
                      bindings.delete_DeleteModel(
                          admin_session, modelName="model_" + str(i)
                      )
                  # model is has already been cleaned up
                  except errors.NotFoundException:
                      continue
  
imports: import uuid
  from typing import Any, Dict, List, Tuple
  import pytest
  from determined.common import util
  from determined.common.api import Session, authentication, bindings, errors
  from determined.common.api.bindings import experimentv1State
  from determined.common.experimental import model
  from determined.experimental import Checkpoint, Determined
  from determined.experimental import client
  from tests import api_utils
  from tests import config
  from tests import experiment
  from tests.cluster.test_rbac import create_workspaces_with_users
  from tests.cluster.test_users import log_in_user_cli, logged_in_user
  from .test_groups import det_cmd
  from .test_workspace_org import setup_workspaces
label_desc: Use image node_id 8 for calling a global function with example usage: test_model_rbac_deletes() without return types