anchor.diff:      User2ParamsOtherAddress = update_req_params(User2ReqParams2, OtherRestAddress, address),
   
       %% check if space is in list of user2 space
  -    ?assertMatch([[SID1], <<"undefined">>], get_user_spaces(User2ReqParams2)),
  -    ?assertMatch([[SID1], <<"undefined">>], get_user_spaces(User2ParamsOtherAddress)),
  +    [User2Spaces, _] = get_user_spaces(User2ReqParams2),
  +    ?assert(lists:member(SID1, User2Spaces)),
  +    ?assertMatch([User2Spaces, _], get_user_spaces(User2ParamsOtherAddress)),
   
       %% check if user2 is in list of space's users
       ?assertMatch(true, is_included([UserId2], get_space_users(SID1, User2ReqParams2))),
  
positive.code:     User1ParamsOtherAddress = update_req_params(User1ReqParams, OtherRestAddress, address),
  
      {_UserId2, User2ReqParams} = register_user(?USER_NAME2, ProviderId, Config, ProviderReqParams),
      SID1 = create_space_for_user(?SPACE_NAME1, User1ParamsOtherAddress),
      InvitationToken = get_space_invitation_token(users, SID1, User1ReqParams),
  
      join_user_to_space(InvitationToken, User2ReqParams),
  
      User2ParamsOtherAddress = update_req_params(User2ReqParams, OtherRestAddress, address),
      ?assertMatch(ok, check_status(user_leaves_space(SID1, User2ReqParams))),
      ?assertMatch([[SID1], <<"undefined">>], get_user_spaces(User1ReqParams)),
      ?assertMatch([[SID1], <<"undefined">>], get_user_spaces(User1ParamsOtherAddress)),
      ?assertMatch([[], <<"undefined">>], get_user_spaces(User2ReqParams)),
      ?assertMatch([[], <<"undefined">>], get_user_spaces(User2ParamsOtherAddress)).
  
  invite_user_to_space_test(Config) ->
      ProviderId = ?config(providerId, Config),
  
negative.code:     ParamsWithOtherAddress = update_req_params(UserReqParams, OtherRestAddress, address),
  
      % Every user automatically gets his first space
      [[FirstSpace], DefaultSpace] = get_user_spaces(UserReqParams),
      ?assertMatch(DefaultSpace, FirstSpace),
  
      SID1 = create_space_for_user(?SPACE_NAME1, UserReqParams),
      SID2 = create_space_for_user(?SPACE_NAME1, ParamsWithOtherAddress),
      [SpaceIds, NewDefaultUserSpace] = get_user_spaces(UserReqParams),
      % Default space should not have changed
      ?assertMatch(NewDefaultUserSpace, DefaultSpace),
      ExpectedSpaces = lists:sort([FirstSpace, SID1, SID2]),
      ?assertMatch(ExpectedSpaces, lists:sort(SpaceIds)).
  
  set_user_default_space_test(Config) ->
      UserReqParams = ?config(userReqParams, Config),
      OtherRestAddress = ?config(otherRestAddress, Config),
      ParamsWithOtherAddress = update_req_params(UserReqParams, OtherRestAddress, address),
  
  
      % Every user automatically gets his first space
      [[FirstSpace], DefaultSpace] = get_user_spaces(UserReqParams),
      ?assertMatch(DefaultSpace, FirstSpace),
  
      SID1 = create_space_for_user(?SPACE_NAME1, UserReqParams),
      ExpectedSpaces = lists:sort([SID1, FirstSpace]),
      [NewSpaces1, NewDefaultSpace1] = get_user_spaces(UserReqParams),
      ?assertMatch(ExpectedSpaces, lists:sort(NewSpaces1)),
      ?assertMatch(NewDefaultSpace1, DefaultSpace),
      [NewSpaces2, NewDefaultSpace2] = get_user_spaces(ParamsWithOtherAddress),
      ?assertMatch(ExpectedSpaces, lists:sort(NewSpaces2)),
      ?assertMatch(NewDefaultSpace2, DefaultSpace),
  
      ?assertMatch(ok, check_status(set_default_space_for_user(SID1, UserReqParams))),
      [NewSpaces3, NewDefaultSpace3] = get_user_spaces(UserReqParams),
      ?assertMatch(ExpectedSpaces, lists:sort(NewSpaces3)),
      ?assertMatch(NewDefaultSpace3, SID1),
      [NewSpaces4, NewDefaultSpace4] = get_user_spaces(ParamsWithOtherAddress),
      ?assertMatch(ExpectedSpaces, lists:sort(NewSpaces4)),
      ?assertMatch(NewDefaultSpace4, SID1),
      ?assertMatch(SID1, get_user_default_space(UserReqParams)),
      ?assertMatch(SID1, get_user_default_space(ParamsWithOtherAddress)).
  
  