code: def test_mongo_store_partition_add_remove_permission(
      root_verify_key: SyftVerifyKey,
      mongo_store_partition: MongoStorePartition,
  ) -> None:
      """
      Test the add_permission and remove_permission functions of MongoStorePartition
      """
      # setting up
      res = mongo_store_partition.init_store()
      assert res.is_ok()
      permissions_collection: MongoCollection = (
          mongo_store_partition.permissions.ok()
      )
      obj = MockSyftObject(data=1)
  
      # add the first permission
      obj_read_permission = ActionObjectPermission(
          uid=obj.id,
          permission=ActionPermission.READ,
          credentials=root_verify_key,
      )
      mongo_store_partition.add_permission(obj_read_permission)
      find_res_1 = permissions_collection.find_one(
          {"_id": obj_read_permission.uid}
      )
      assert find_res_1 is not None
      assert len(find_res_1["permissions"]) == 1
      assert find_res_1["permissions"] == {
          obj_read_permission.permission_string,
      }
  
      # add the second permission
      obj_write_permission = ActionObjectPermission(
          uid=obj.id,
          permission=ActionPermission.WRITE,
          credentials=root_verify_key,
      )
      mongo_store_partition.add_permission(obj_write_permission)
  
      find_res_2 = permissions_collection.find_one({"_id": obj.id})
      assert find_res_2 is not None
      assert len(find_res_2["permissions"]) == 2
      assert find_res_2["permissions"] == {
          obj_read_permission.permission_string,
          obj_write_permission.permission_string,
      }
  
      # add duplicated permission
      mongo_store_partition.add_permission(obj_write_permission)
      find_res_3 = permissions_collection.find_one({"_id": obj.id})
      assert len(find_res_3["permissions"]) == 2
      assert find_res_3["permissions"] == find_res_2["permissions"]
  
      # remove the write permission
      mongo_store_partition.remove_permission(obj_write_permission)
      find_res_4 = permissions_collection.find_one({"_id": obj.id})
      assert len(find_res_4["permissions"]) == 1
      assert find_res_1["permissions"] == {
          obj_read_permission.permission_string,
      }
  
      # remove a non-existent permission
      remove_res = mongo_store_partition.remove_permission(
          ActionObjectPermission(
              uid=obj.id,
              permission=ActionPermission.OWNER,
              credentials=root_verify_key,
          )
      )
      assert isinstance(remove_res, Err)
      find_res_5 = permissions_collection.find_one({"_id": obj.id})
      assert len(find_res_5["permissions"]) == 1
      assert find_res_1["permissions"] == {
          obj_read_permission.permission_string,
      }
  
      # there is only one permission object
      assert permissions_collection.count_documents({}) == 1
  
      # add permissions in a loop
      new_permissions = []
      for idx in range(1, REPEATS + 1):
          new_obj = MockSyftObject(data=idx)
          new_obj_read_permission = ActionObjectPermission(
              uid=new_obj.id,
              permission=ActionPermission.READ,
              credentials=root_verify_key,
          )
          new_permissions.append(new_obj_read_permission)
          mongo_store_partition.add_permission(new_obj_read_permission)
          assert permissions_collection.count_documents({}) == 1 + idx
  
      # remove all the permissions added in the loop
      for permission in new_permissions:
          mongo_store_partition.remove_permission(permission)
  
      assert permissions_collection.count_documents({}) == 1
  
imports: import sys
  from threading import Thread
  from typing import List
  from typing import Set
  from typing import Tuple
  from joblib import Parallel
  from joblib import delayed
  from pymongo.collection import Collection
  import pytest
  from result import Err
  from syft.node.credentials import SyftVerifyKey
  from syft.service.action.action_permissions import ActionObjectPermission
  from syft.service.action.action_permissions import ActionPermission
  from syft.service.action.action_store import ActionObjectEXECUTE
  from syft.service.action.action_store import ActionObjectOWNER
  from syft.service.action.action_store import ActionObjectREAD
  from syft.service.action.action_store import ActionObjectWRITE
  from syft.store.document_store import PartitionSettings
  from syft.store.document_store import QueryKey
  from syft.store.document_store import QueryKeys
  from syft.store.mongo_client import MongoStoreClientConfig
  from syft.store.mongo_document_store import MongoStoreConfig
  from syft.store.mongo_document_store import MongoStorePartition
  from .store_constants_test import generate_db_name
  from .store_constants_test import test_verify_key_string_hacker
  from .store_fixtures_test import mongo_store_partition_fn
  from .store_mocks_test import MockObjectType
  from .store_mocks_test import MockSyftObject
label_desc: Use image node_id 13 for calling a global function with example usage: test_mongo_store_partition_add_remove_permission(root_verify_key, mongo_store_partition) without return types