code: def test_run_artifact_event(run):
      observer = run.observers[0]
      handle, f_name = tempfile.mkstemp()
      name = "foobar"
      metadata = {"testkey": 42}
      content_type = "text/plain"
      run.add_artifact(
          f_name,
          name=name,
          metadata=metadata,
          content_type=content_type,
      )
      observer.artifact_event.assert_called_with(
          filename=f_name,
          name=name,
          metadata=metadata,
          content_type=content_type,
      )
      os.close(handle)
      os.remove(f_name)
  
imports: from datetime import datetime
  import mock
  import os
  import pytest
  import tempfile
  import sys
  from sacred.run import Run
  from sacred.config.config_summary import ConfigSummary
  from sacred.utils import ObserverError, SacredInterrupt, TimeoutInterrupt, apply_backspaces_and_linefeeds
label_desc: Use image node_id 11 for calling a global function with example usage: test_run_artifact_event(run) without return types