code: def test_detail_prof_init_and_url_studio_user_valid_medatada(
      mock_file_exists,
  ):
      """
      Test DetailProfilerApp for Studio user when the notebook metadata file provided by Studio is valid.
      """
      mock_file_exists.return_value = True
      with patch(
          "builtins.open", mock_open(read_data=TEST_NOTEBOOK_METADATA)
      ):
          detail_profiler_app = DetailProfilerApp(TEST_REGION)
          assert detail_profiler_app.region == TEST_REGION
          assert detail_profiler_app._domain_id == TEST_DOMAIN
          assert (
              detail_profiler_app._user_profile_name
              == TEST_USER_PROFILE
          )
          assert detail_profiler_app._valid_domain_and_user is True
  
          # test url without job redirect
          assert (
              detail_profiler_app.get_app_url()
              == BASE_URL_STUDIO_FORMAT.format(TEST_DOMAIN, TEST_REGION)
          )
  
          # test url with valid job redirect
          assert detail_profiler_app.get_app_url(
              TEST_TRAINING_JOB
          ) == BASE_URL_STUDIO_FORMAT.format(
              TEST_DOMAIN, TEST_REGION
          ) + REDIRECT_STUDIO_FORMAT.format(
              TEST_TRAINING_JOB
          )
  
          # test url with invalid job redirect
          with pytest.raises(ValueError):
              detail_profiler_app.get_app_url("invald_job_name!")
  
file_path: sagemaker-python-sdk/tests/unit/test_profiler_app.py
imports: from __future__ import absolute_import
  from sagemaker.interactive_apps.detail_profiler_app import DetailProfilerApp
  from unittest.mock import patch, mock_open, PropertyMock
  import json
  import pytest
label_desc: Use image node_id 2 for calling a global function with example usage: test_detail_prof_init_and_url_studio_user_valid_medatada(mock_file_exists) without return types