code: def test_creation_when_not_existing(monkeypatch, tmp_path):
      """Test if a configuration file is created when it does not exist."""
      config_path = str(tmp_path) + "/tmp_config.yaml"
      monkeypatch.setattr(
          orion.core, "DEF_CONFIG_FILES_PATHS", [config_path]
      )
      monkeypatch.setattr(
          builtins, "input", _mock_input(["mongodb", "host", "name"])
      )
  
      try:
          os.remove(config_path)
      except FileNotFoundError:
          pass
  
      orion.core.cli.main(["db", "setup"])
  
      assert os.path.exists(config_path)
  
      with open(config_path) as output:
          content = yaml.safe_load(output)
  
      assert content == {
          "database": {
              "type": "mongodb",
              "name": "name",
              "host": "host",
          }
      }
  
file_path: orion/tests/functional/commands/test_setup_command.py
imports: import builtins
  import os
  import yaml
  import orion.core
  import orion.core.cli
  from orion.core.io.database import database_factory
label_desc: Use image node_id 1 for calling a global function with example usage: test_creation_when_not_existing(monkeypatch, tmp_path) without return types