code: def test_notebook() -> None:
      u_viewer_ws0 = api_utils.create_test_user(add_password=True)
      u_editor_ws1 = api_utils.create_test_user(add_password=True)
      admin_session = api_utils.determined_test_session(
          conf.ADMIN_CREDENTIALS
      )
  
      with setup_workspaces(count=2) as workspaces:
          api_utils.assign_user_role(
              session=admin_session,
              user=u_viewer_ws0.username,
              role="Viewer",
              workspace=workspaces[0].name,
          )
          api_utils.assign_user_role(
              session=admin_session,
              user=u_editor_ws1.username,
              role="Editor",
              workspace=workspaces[1].name,
          )
  
          nb_reqs = [
              bindings.v1LaunchNotebookRequest(
                  workspaceId=workspaces[0].id
              ),
              bindings.v1LaunchNotebookRequest(
                  workspaceId=workspaces[1].id
              ),
              bindings.v1LaunchNotebookRequest(),
          ]
          with setup_notebooks(admin_session, nb_reqs) as notebooks:
              r = bindings.get_GetNotebooks(admin_session)
              assert len(filter_out_ntsc(notebooks, r.notebooks)) == 3
              r = bindings.get_GetNotebooks(
                  admin_session, workspaceId=workspaces[0].id
              )
              assert len(filter_out_ntsc(notebooks, r.notebooks)) == 1
              r = bindings.get_GetNotebooks(
                  admin_session, workspaceId=workspaces[1].id
              )
              assert len(filter_out_ntsc(notebooks, r.notebooks)) == 1
              r = bindings.get_GetNotebooks(
                  admin_session, workspaceId=DEFAULT_WID
              )
              assert len(filter_out_ntsc(notebooks, r.notebooks)) == 1
  
              r = bindings.get_GetNotebooks(
                  api_utils.determined_test_session(u_viewer_ws0)
              )
              assert len(r.notebooks) == 1
              r = bindings.get_GetNotebooks(
                  api_utils.determined_test_session(u_viewer_ws0),
                  workspaceId=workspaces[0].id,
              )
              assert len(r.notebooks) == 1
              with pytest.raises(errors.APIException) as e:
                  r = bindings.get_GetNotebooks(
                      api_utils.determined_test_session(u_viewer_ws0),
                      workspaceId=workspaces[1].id,
                  )
                  assert e.value.status_code == 404
  
              # User with only view role on first workspace
              with logged_in_user(u_viewer_ws0):
                  json_out = det_cmd_json(
                      ["notebook", "ls", "--all", "--json"]
                  )
                  assert len(json_out) == 1
  
file_path: determined/e2e_tests/tests/cluster/test_rbac_ntsc.py
imports: import contextlib
  from typing import Generator, List, Optional, Sequence
  import pytest
  import tests.config
  from determined.common import api
  from determined.common.api import authentication, bindings, errors
  from tests import api_utils
  from tests import experiment
  from tests.cluster.test_rbac import create_workspaces_with_users, rbac_disabled
  from tests.cluster.test_workspace_org import setup_workspaces
  from .test_groups import det_cmd_json
  from .test_users import logged_in_user
label_desc: Use image node_id 3 for calling a global function with example usage: test_notebook() without return types