class_docstr: Calls to :meth:`orion.core.io.database.AbstractDB.ensure_index`.
docstr: Index should be added to database
docstr_tok: ["Index","should","be","added","to","database"]
code: def test_new_index(self, orion_db, db_test_data):
      """Index should be added to database"""
      unique, key, stored_key, key_present = db_test_data
      assert (
          stored_key
          not in get_db(orion_db)["new_collection"].index_information()
      )
  
      orion_db.ensure_index("new_collection", key, unique=unique)
      assert (
          stored_key
          in get_db(orion_db)["new_collection"].index_information()
      ) == key_present
  
imports: import pickle
  from datetime import datetime
  import pytest
  from orion.core.io.database import Database, DatabaseError, DuplicateKeyError
  from orion.core.io.database.ephemeraldb import EphemeralDB
  from orion.core.io.database.mongodb import MongoDB
  from orion.core.io.database.pickleddb import PickledDB
  from .conftest import insert_test_collection
label_desc: Use image node_id 1 for calling the TestEnsureIndex obj's underlying member method code with example usage: obj.test_new_index(orion_db, db_test_data) without return types