def test_import_valid_objects(self):
     num_imported, errors = import_objects(self.mock_db_map,
                                           [["existing_oc1", "new_object"]])
     self.mock_db_map._add_objects.assert_called_once_with({
         "name": "new_object",
         "class_id": 1
     })
     self.assertEqual(len(errors), 0)
 def import_objects(self, objects) -> int:
     """Add objects of specific class from a list of class name and object name tuples
     Returns:
         n_imported (int): Number of imported entities
     """
     n_imported, errors = import_functions.import_objects(
         self._db_map, objects)
     if errors:
         self._handle_errors(errors)
     return n_imported
 def test_import_existing_object(self):
     num_imported, errors = import_objects(
         self.mock_db_map, [["existing_oc1", "existing_o1"]])
     self.mock_db_map._add_objects.assert_called_once_with()
     self.assertEqual(len(errors), 0)
 def test_import_object_with_invalid_object_class_name(self):
     num_imported, errors = import_objects(
         self.mock_db_map, [["invalid_class_name", "new_object"]])
     self.mock_db_map._add_objects.assert_called_once()
     self.assertEqual(len(errors), 1)