anchor.diff:          _Providers = ?config(op_worker_nodes, Config),
           ClientSpec,
           DataSpec,
  -        _QsParams = [<<"inherited">>, <<"filter_type">>, <<"filter">>],
  +        QsParams,
           Config
       ).
   
  
positive.code:         false -> ?CLIENT_SPEC_FOR_SPACE_2_SCENARIOS(Config)
      end,
      DataSpec = #data_spec{
          optional = [<<"inherited">>, <<"filter_type">>, <<"filter">>],
          correct_values = #{
              <<"inherited">> => [true, false],
              <<"filter_type">> => [<<"keypath">>],
  
negative.code:         catch throw:Error ->
              Error
          end
      end.
  
  
  get_file_xattrs_on_provider_not_supporting_space_test(Config) ->
      get_xattrs_on_provider_not_supporting_space_test_base(<<"file">>, Config).
  
  
  get_dir_xattrs_on_provider_not_supporting_space_test(Config) ->
      get_xattrs_on_provider_not_supporting_space_test_base(<<"dir">>, Config).
  
  
  %% @private
  get_xattrs_on_provider_not_supporting_space_test_base(FileType, Config) ->
      [P2, P1] = Providers = ?config(op_worker_nodes, Config),
      SessIdP1 = ?USER_IN_BOTH_SPACES_SESS_ID(P1, Config),
  
      FilePath = filename:join(["/", ?SPACE_1, ?RANDOM_FILE_NAME]),
      {ok, FileGuid} = create_file(FileType, P1, SessIdP1, FilePath),
      ?assertMatch(ok, lfm_proxy:set_xattr(P1, SessIdP1, {guid, FileGuid}, ?XATTR_1)),
  
      GetExpCallResultFun = fun(_TestCtx) -> {ok, #{?XATTR_1_KEY => ?XATTR_1_VALUE}} end,
  
      get_metadata_test_base(
          <<"xattrs">>,
          FileType, FilePath, FileGuid, undefined,
          create_validate_get_metadata_rest_call_fun(GetExpCallResultFun, P2),
          create_validate_get_metadata_gs_call_fun(GetExpCallResultFun, P2),
          Providers,
          ?CLIENT_SPEC_FOR_SPACE_1_SCENARIOS(Config),
          _DataSpec = undefined,
          _QsParams = [],
          Config
      ).
  
  
  %%%===================================================================
  %%% Get metadata generic functions
  %%%===================================================================
  
  
  %% @private
  create_validate_get_metadata_rest_call_fun(GetExpResultFun) ->
      create_validate_get_metadata_rest_call_fun(GetExpResultFun, undefined).
  
  
  %% @private
  create_validate_get_metadata_rest_call_fun(GetExpResultFun, ProviderNotSupportingSpace) ->
      fun
          (#api_test_ctx{node = TestNode}, {ok, RespCode, RespBody}) when TestNode == ProviderNotSupportingSpace ->
              ProviderDomain = ?GET_DOMAIN_BIN(ProviderNotSupportingSpace),
              ExpError = ?REST_ERROR(?ERROR_SPACE_NOT_SUPPORTED_BY(ProviderDomain)),
              ?assertEqual({?HTTP_400_BAD_REQUEST, ExpError}, {RespCode, RespBody});
          (TestCtx, {ok, RespCode, RespBody}) ->
              case GetExpResultFun(TestCtx) of
                  {ok, ExpMetadata} ->
                      ?assertEqual({?HTTP_200_OK, ExpMetadata}, {RespCode, RespBody});
                  {error, _} = Error ->
                      ExpRestError = {errors:to_http_code(Error), ?REST_ERROR(Error)},
                      ?assertEqual(ExpRestError, {RespCode, RespBody})
              end
      end.
  
  
  %% @private
  create_validate_get_metadata_gs_call_fun(GetExpResultFun) ->
      create_validate_get_metadata_gs_call_fun(GetExpResultFun, undefined).
  
  
  %% @private
  create_validate_get_metadata_gs_call_fun(GetExpResultFun, ProviderNotSupportingSpace) ->
      fun
          (#api_test_ctx{node = TestNode}, Result) when TestNode == ProviderNotSupportingSpace ->
              ProviderDomain = ?GET_DOMAIN_BIN(ProviderNotSupportingSpace),
              ExpError = ?ERROR_SPACE_NOT_SUPPORTED_BY(ProviderDomain),
              ?assertEqual(ExpError, Result);
          (TestCtx, Result) ->
              case GetExpResultFun(TestCtx) of
                  {ok, ExpMetadata} ->
                      ?assertEqual({ok, #{<<"metadata">> => ExpMetadata}}, Result);
                  {error, _} = ExpError ->
                      ?assertEqual(ExpError, Result)
              end
      end.
  
  
  %% @private
  -spec get_metadata_test_base(
      MetadataType :: binary(),  %% <<"json">> | <<"rdf">> | <<"xattrs">>
      FileType :: binary(),      %% <<"dir">> | <<"file">>
      FilePath :: file_meta:path(),
      FileGuid :: file_id:file_guid(),
      ShareId :: undefined | od_share:id(),
      ValidateRestCallResultFun :: fun((api_test_ctx(), {ok, RespCode :: pos_integer(), RespBody :: term()}) -> ok),
      ValidateGsCallResultFun :: fun((api_test_ctx(), Result :: term()) -> ok),
      Providers :: [node()],
      client_spec(),
      data_spec(),
      QsParameters :: [binary()],
      Config :: proplists:proplist()
  ) ->
      ok.
  get_metadata_test_base(
      MetadataType, FileType, FilePath, FileGuid, _ShareId = undefined,
      ValidateRestCallResultFun, ValidateGsCallResultFun,
      Providers, ClientSpec, DataSpec, QsParameters, Config
  ) ->
      {ok, FileObjectId} = file_id:guid_to_objectid(FileGuid),
  
      ?assert(api_test_utils:run_scenarios(Config, [
          #scenario_spec{
              name = <<"Get ", MetadataType/binary, " metadata from ", FileType/binary, " using rest endpoint">>,
              type = rest,
              target_nodes = Providers,
              client_spec = ClientSpec,
              prepare_args_fun = ?GET_METADATA_REST_ARGS_FUN(MetadataType, FileObjectId, QsParameters),
              validate_result_fun = ValidateRestCallResultFun,
              data_spec = DataSpec
          },
          #scenario_spec{
              name = <<"Get ", MetadataType/binary, " metadata from ", FileType/binary, " using deprecated path rest endpoint">>,
              type = rest_with_file_path,
              target_nodes = Providers,
              client_spec = ClientSpec,
              prepare_args_fun = ?GET_METADATA_DEPRECATED_PATH_REST_ARGS_FUN(MetadataType, FilePath, QsParameters),
              validate_result_fun = ValidateRestCallResultFun,
              data_spec = DataSpec
          },
          #scenario_spec{
              name = <<"Get ", MetadataType/binary, " metadata from ", FileType/binary, " using deprecated id rest endpoint">>,
              type = rest,
              target_nodes = Providers,
              client_spec = ClientSpec,
              prepare_args_fun = ?GET_METADATA_DEPRECATED_ID_REST_ARGS_FUN(MetadataType, FileObjectId, QsParameters),
              validate_result_fun = ValidateRestCallResultFun,
              data_spec = DataSpec
          },
          #scenario_spec{
              name = <<"Get ", MetadataType/binary, " metadata from ", FileType/binary, " using gs api">>,
              type = gs,
              target_nodes = Providers,
              client_spec = ClientSpec,
              prepare_args_fun = ?GET_METADATA_GS_ARGS_FUN(MetadataType, FileGuid, private),
              validate_result_fun = ValidateGsCallResultFun,
              data_spec = DataSpec
          }
      ]));
  get_metadata_test_base(
      MetadataType, FileType, _FilePath, FileGuid, ShareId,
      ValidateRestCallResultFun, ValidateGsCallResultFun,
      Providers, _ClientSpec, DataSpec, QsParameters, Config
  ) ->
      FileShareGuid = file_id:guid_to_share_guid(FileGuid, ShareId),
      {ok, FileShareObjectId} = file_id:guid_to_objectid(FileShareGuid),
  
      % Special case -> any user can make requests for shares but if request is
      % being made using credentials by user not supported on specific provider
      % ?ERROR_USER_NOT_SUPPORTED will be returned
      ClientSpec = #client_spec{
          correct = [?NOBODY, ?USER_IN_SPACE_1_AUTH, ?USER_IN_SPACE_2_AUTH, ?USER_IN_BOTH_SPACES_AUTH],
          unauthorized = [],
          forbidden = [],
          supported_clients_per_node = ?SUPPORTED_CLIENTS_PER_NODE(Config)
      },
  
      ?assert(api_test_utils:run_scenarios(Config, [
          #scenario_spec{
              name = <<"Get ", MetadataType/binary, " metadata from shared ", FileType/binary, " using rest endpoint">>,
              type = rest,
              target_nodes = Providers,
              client_spec = ClientSpec,
              prepare_args_fun = ?GET_METADATA_REST_ARGS_FUN(MetadataType, FileShareObjectId, QsParameters),
              validate_result_fun = ValidateRestCallResultFun,
              data_spec = DataSpec
          },
          #scenario_spec{
              name = <<"Get ", MetadataType/binary, " metadata from shared ", FileType/binary, " using deprecated id rest endpoint">>,
              type = rest,
              target_nodes = Providers,
              client_spec = ClientSpec,
              prepare_args_fun = ?GET_METADATA_DEPRECATED_ID_REST_ARGS_FUN(MetadataType, FileShareObjectId, QsParameters),
              validate_result_fun = ValidateRestCallResultFun,
              data_spec = DataSpec
          },
          #scenario_spec{
              name = <<"Get ", MetadataType/binary, " metadata from shared ", FileType/binary, " using gs public api">>,
              type = gs,
              target_nodes = Providers,
              client_spec = ClientSpec,
              prepare_args_fun = ?GET_METADATA_GS_ARGS_FUN(MetadataType, FileShareGuid, public),
              validate_result_fun = ValidateGsCallResultFun,
              data_spec = DataSpec
          },
          #scenario_spec{
              name = <<"Get ", MetadataType/binary, " metadata from shared ", FileType/binary, " using private gs api">>,
              type = gs,
              target_nodes = Providers,
              client_spec = ClientSpec,
              prepare_args_fun = ?GET_METADATA_GS_ARGS_FUN(MetadataType, FileShareGuid, private),
              validate_result_fun = fun(_, Result) ->
                  ?assertEqual(?ERROR_UNAUTHORIZED, Result)
              end,
              data_spec = DataSpec
          }
      ])).
  
  