anchor.diff:                  RequiredPrivs = case TransferType of
                       replication -> [?SPACE_CANCEL_REPLICATION];
                       eviction -> [?SPACE_CANCEL_EVICTION];
  -                    migration -> [?SPACE_CANCEL_REPLICATION, ?SPACE_CANCEL_EVICTION]
  +                    migration -> lists:sort([?SPACE_CANCEL_REPLICATION, ?SPACE_CANCEL_EVICTION])
                   end,
                   SpacePrivs = AllSpacePrivs -- RequiredPrivs,
                   ErrorForbidden = rest_test_utils:get_rest_error(?ERROR_FORBIDDEN),
   
  -                initializer:testmaster_mock_space_user_privileges([Worker], SpaceId, CancelingUser, SpacePrivs),
  -                {ok, Code1, _, Resp1} = rest_test_utils:request(Worker, HTTPPath, delete, Headers, []),
  -                ?assertMatch(ErrorForbidden, {Code1, json_utils:decode(Resp1)}),
  +                lists:foreach(fun
  +                    (PrivsToAdd) when PrivsToAdd =:= RequiredPrivs ->
  +                        % success will be checked later
  +                        ok;
  +                    (PrivsToAdd) ->
  +                        initializer:testmaster_mock_space_user_privileges([Worker], SpaceId, CancelingUser, SpacePrivs ++ PrivsToAdd),
  +                        {ok, Code, _, Resp} = rest_test_utils:request(Worker, HTTPPath, delete, Headers, []),
  +                        ?assertMatch(ErrorForbidden, {Code, json_utils:decode(Resp)})
  +                end, combinations(RequiredPrivs)),
   
                   initializer:testmaster_mock_space_user_privileges([Worker], SpaceId, CancelingUser, SpacePrivs ++ RequiredPrivs),
                   ?assertMatch(
  
positive.code:     Headers = [?USER_TOKEN_HEADER(Config, User)],
  
      AllSpacePrivs = privileges:space_privileges(),
      SpacePrivs = AllSpacePrivs -- [?SPACE_SCHEDULE_REPLICATION, ?SPACE_SCHEDULE_EVICTION, ?SPACE_QUERY_INDICES],
      UserSpacePrivs = rpc:call(ScheduleNode, initializer, node_get_mocked_space_user_privileges, [SpaceId, User]),
      ErrorForbidden = rest_test_utils:get_rest_error(?ERROR_FORBIDDEN),
  
      try
          lists:foreach(fun(PrivsToAdd) ->
              initializer:testmaster_mock_space_user_privileges([ScheduleNode], SpaceId, User, SpacePrivs ++ PrivsToAdd),
              {ok, Code, _, Resp} = rest_test_utils:request(ScheduleNode, HTTPPath, delete, Headers, []),
              ?assertMatch(ErrorForbidden, {Code, json_utils:decode(Resp)})
          end, [
              [],
              [?SPACE_SCHEDULE_REPLICATION],
              [?SPACE_SCHEDULE_EVICTION],
              [?SPACE_QUERY_INDICES],
              [?SPACE_SCHEDULE_REPLICATION, ?SPACE_SCHEDULE_EVICTION],
              [?SPACE_SCHEDULE_REPLICATION, ?SPACE_QUERY_INDICES],
              [?SPACE_SCHEDULE_EVICTION, ?SPACE_QUERY_INDICES]
          ]),
  
          initializer:testmaster_mock_space_user_privileges([ScheduleNode], SpaceId, User, SpacePrivs ++ [
              ?SPACE_SCHEDULE_REPLICATION, ?SPACE_SCHEDULE_EVICTION, ?SPACE_QUERY_INDICES
          ]),
          case rest_test_utils:request(ScheduleNode, HTTPPath, delete, Headers, []) of
              {ok, 200, _, Body} ->
                  DecodedBody = json_utils:decode(Body),
  
negative.code:     float_to_binary(Val);
  binary_from_term(Val) when is_atom(Val) ->
      atom_to_binary(Val, utf8).
  
  
  combinations([]) ->
      [[]];
  combinations([Item]) ->
      [[Item], []];
  combinations([Item | Items]) ->
      ItemsCombinations = combinations(Items),
      ItemsCombinations ++ lists:map(fun(Comb) ->
          lists:sort([Item | Comb])
      end, ItemsCombinations).
  