anchor.diff:  
   %% provider_rest_module_test_group====================================
   
  -provider_crud_test(Config) ->
  -    RestAddress = ?config(restAddress, Config),
  -    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  -    
  +provider_create_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
       {ProviderId, ProviderReqParams} =
           register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
   
       ?assertMatch(
           [?CLIENT_NAME1, ?URLS1, ?REDIRECTION_POINT1, ProviderId],
           read_provider(ProviderReqParams)
  -    ),
  +    ).
  +
  +provider_update_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
   
       update_provider(?URLS2, ?REDIRECTION_POINT2, ?CLIENT_NAME2, ProviderReqParams),
   
       ?assertMatch(
           [?CLIENT_NAME2, ?URLS2, ?REDIRECTION_POINT2, ProviderId],
           read_provider(ProviderReqParams)
  -    ),
  +    ).
  +
  +provider_get_data_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
   
       ?assertMatch(
  -        [?CLIENT_NAME2, ?URLS2, ?REDIRECTION_POINT2, ProviderId],
  +        [?CLIENT_NAME1, ?URLS1, ?REDIRECTION_POINT1, ProviderId],
           get_provider_data_by_pid(ProviderId, ProviderReqParams)
  -    ),
  -
  -    delete_provider(ProviderReqParams),
  -
  +    ).
  +
  +provider_delete_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +    
  +    {_ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    ?assertMatch(ok, check_status(delete_provider(ProviderReqParams))),
       ?assertMatch(request_error,read_provider(ProviderReqParams)).
   
  -provider_space_test(Config) ->
  -    RestAddress = ?config(restAddress, Config),
  -    [Node] = ?config(gr_nodes, Config),
  -    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  -
  -    {ProviderId, ProviderReqParams} =
  -        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  -
  -    %% create user
  -    UserId = create_user(?USER_NAME1, Node),
  -
  -    %% authenticate user
  -    NewHeaders = auth_user(UserId, ProviderId, ReqParams, Node),
  -    UserReqParams = update_req_params(ProviderReqParams, NewHeaders, headers),
  +provider_create_space_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
   
       %% get space creation token1
       SCRToken1 = get_space_creation_token_for_user(UserReqParams),
  -
       SID1 = create_space_for_provider(SCRToken1, ?SPACE_NAME1, ?SPACE_SIZE1, ProviderReqParams),
   
  -    %% get space creation token2
  -    SCRToken2 = get_space_creation_token_for_user(UserReqParams),
  -
  -    SID2 = create_space_for_provider(SCRToken2, ?SPACE_NAME2, ?SPACE_SIZE2, ProviderReqParams),
  -
  -    SupportedSpaces = get_provider_spaces(ProviderReqParams),
  -
  -    ?assertMatch(true, is_included([SID1, SID2], SupportedSpaces)),
  -
  -    DeleteResponse = delete_provider_space(SID1, ProviderReqParams),
  -
  -    ?assertMatch(ok, check_status(DeleteResponse)),
  -
  -    SupportedSpaces2 = get_provider_spaces(ProviderReqParams),
  -
  -    ?assertMatch([[SID2]], SupportedSpaces2),
  -
  -    [SID_test, SpaceName_test, {[{ProviderId_test, SpaceSize}]}] =
  -        get_provider_space(SID2, ProviderReqParams),
  +    ?assertMatch(true, is_included([SID1], get_provider_spaces(ProviderReqParams))).
  +
  +provider_get_space_data_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    %% get space creation token1
  +    SCRToken1 = get_space_creation_token_for_user(UserReqParams),
  +    SID = create_space_for_provider(SCRToken1, ?SPACE_NAME1, ?SPACE_SIZE1, ProviderReqParams),
  +
  +    %% assertMatch has problem with nested brackets below
  +    [SID_test, SpaceName_test, {[{ProviderId_test, SpaceSize_test}]}] =
  +        get_provider_space(SID, ProviderReqParams),
   
       ?assertMatch(
  -        [SID_test, SpaceName_test, ProviderId_test, SpaceSize],
  -        [SID2, ?SPACE_NAME2, ProviderId, binary_to_integer(?SPACE_SIZE2)]
  +        [SID_test, SpaceName_test, ProviderId_test, SpaceSize_test],
  +        [SID, ?SPACE_NAME1, ProviderId, binary_to_integer(?SPACE_SIZE1)]
       ).
   
  -provider_check_test(Config) ->
  +provider_delete_space_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    %% get space creation token1
  +    SCRToken1 = get_space_creation_token_for_user(UserReqParams),
  +    SID = create_space_for_provider(SCRToken1, ?SPACE_NAME1, ?SPACE_SIZE1, ProviderReqParams),
  +
  +    ?assertMatch(ok, check_status(delete_provider_space(SID, ProviderReqParams))).
  +
  +provider_support_space_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    SID = create_space_for_user(?SPACE_NAME1, UserReqParams),
  +    Token = get_space_support_token(SID, UserReqParams),
  +
  +    ?assertMatch(ok,
  +        check_status(provider_support_space(Token, ?SPACE_SIZE1, ProviderReqParams))),
  +    ?assertMatch(true, is_included([SID], get_provider_spaces(ProviderReqParams))).
  +
  +provider_check_ip_test(Config) ->
       RestAddress = ?config(restAddress, Config),
       ReqParams = {RestAddress, [], []},
  -    ?assertMatch(ok, check_status(check_provider_ip(ReqParams))),
  +    ?assertMatch(ok, check_status(check_provider_ip(ReqParams))).
  +
  +provider_check_port_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, [], []},
       ?assertMatch(ok, check_status(check_provider_ports(ReqParams))).
   
  -%%%===================================================================
  -
   %% user_rest_module_test_group========================================
   
  -user_crud_test(Config) ->
  -    RestAddress = ?config(restAddress, Config),
  -    [Node] = ?config(gr_nodes, Config),
  -    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +user_authenticate_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    ?assertMatch([UserId, ?USER_NAME1], read_user(UserReqParams)).
  +
  +user_update_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    ?assertMatch(ok, check_status(update_user(?USER_NAME2, UserReqParams))),
  +    ?assertMatch([UserId, ?USER_NAME2], read_user(UserReqParams)).
  +
  +user_delete_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    ?assertMatch(ok, check_status(delete_user(UserReqParams))),
  +    ?assertMatch(request_error, read_user(UserReqParams)).
  +
  +user_merge_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId1, UserReqParams1} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +    {_UserId2, UserReqParams2} =
  +        register_user(?USER_NAME2, ProviderId, Config, ProviderReqParams),
  +
  +    MergeToken = get_user_merge_token(UserReqParams2),
  +
  +    ?assertMatch(ok, check_status(merge_users(MergeToken, UserReqParams1))).
  +
  +user_create_space_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    SID1 = create_space_for_user(?SPACE_NAME1, UserReqParams),
  +    SID2 = create_space_for_user(?SPACE_NAME1, UserReqParams),
  +
  +    ?assertMatch([[SID1, SID2], <<"undefined">>], get_user_spaces(UserReqParams)).
  +
  +user_default_space_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    SID1 = create_space_for_user(?SPACE_NAME1, UserReqParams),
  +
  +    ?assertMatch([[SID1], <<"undefined">>], get_user_spaces(UserReqParams)),
  +    ?assertMatch(ok, check_status(set_default_space_for_user(SID1, UserReqParams))),
  +    ?assertMatch([[SID1], SID1], get_user_spaces(UserReqParams)),
  +    ?assertMatch(SID1, get_user_default_space(UserReqParams)).
  +
  +user_get_space_data_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    SID = create_space_for_user(?SPACE_NAME1, UserReqParams),
  +    ?assertMatch([SID, ?SPACE_NAME1], get_user_space(SID, UserReqParams)).
  +
  +user_delete_space_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    SID1 = create_space_for_user(?SPACE_NAME1, UserReqParams),
  +    ?assertMatch(ok, check_status(delete_user_space(SID1, UserReqParams))),
  +    ?assertMatch([[],<<"undefined">>], get_user_spaces(UserReqParams)).
  +
  +user_space_invite_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId1, UserReqParams1} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    {_UserId2, UserReqParams2} =
  +        register_user(?USER_NAME2, ProviderId, Config, ProviderReqParams),
  +
  +    SID1 = create_space_for_user(?SPACE_NAME1, UserReqParams1),
       
  -    {ProviderId, ProviderReqParams} =
  -        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  -
  -     %% create user
  -    UserId = create_user(?USER_NAME1, Node),
  -
  -    %% authenticate user
  -    NewHeaders = auth_user(UserId, ProviderId, ReqParams, Node),
  -    UserReqParams = update_req_params(ProviderReqParams, NewHeaders, headers),
  -
  -    %% check if user data is correct
  -    ?assertMatch([UserId, ?USER_NAME1], read_user(UserReqParams)),
  -
  -    update_user(?USER_NAME2, UserReqParams),
  -
  -    %% check if user data was updated
  -    ?assertMatch([UserId, ?USER_NAME2], read_user(UserReqParams)),
  -
  -     UserId2 = create_user(?USER_NAME2, Node),
  -
  -    %% authenticate user
  -    NewHeaders2 = auth_user(UserId2, ProviderId, ReqParams, Node),
  -    UserReqParams2 = update_req_params(ProviderReqParams, NewHeaders2, headers),
  -
  -    MergeToken = get_user_merge_token(UserReqParams2),
  -
  -    %%  merge user2 with user1
  -    Response = merge_users(MergeToken, UserReqParams),
  -
  -    ?assertMatch(ok, check_status(Response)),
  -
  -    DeleteResponse = delete_user(UserReqParams),
  -    ?assertMatch(ok, check_status(DeleteResponse)),
  -
  -    %% try to read deleted user
  -    ?assertMatch(request_error, read_user(UserReqParams)).
  -
  -user_space_test(Config) ->
  -    RestAddress = ?config(restAddress, Config),
  -    [Node] = ?config(gr_nodes, Config),
  -    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  -
  -    {ProviderId, ProviderReqParams} =
  -        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +    InvitationToken = get_space_invitation_token(users, SID1, UserReqParams1),
       
  -    %% create user
  -    UserId = create_user(?USER_NAME1, Node),
  -
  -    %% authenticate user
  -    NewHeaders = auth_user(UserId, ProviderId, ReqParams, Node),
  -    UserReqParams = update_req_params(ProviderReqParams, NewHeaders, headers),
  -
  -    SID1 = create_space_for_user(?SPACE_NAME1, UserReqParams),
  -    SID2 = create_space_for_user(?SPACE_NAME2, UserReqParams),
  -
  -    ?assertMatch([[SID1, SID2], <<"undefined">>], get_user_spaces(UserReqParams)),
  -
  -    set_default_space_for_user(SID2, UserReqParams),
  -
  -    ?assertMatch([[SID1, SID2], SID2], get_user_spaces(UserReqParams)),
  -
  -    ?assertMatch(SID2, get_user_default_space(UserReqParams)),
  -
  -    ?assertMatch([SID1, ?SPACE_NAME1], get_user_space(SID1, UserReqParams)),
  -
  -    DeleteResponse = delete_user_space(SID1, UserReqParams),
  -    ?assertMatch(ok, check_status(DeleteResponse)),
  -
  -    %% try to read deleted user's space
  -    ?assertMatch(request_error, get_user_space(SID1, UserReqParams)).
  -
  -many_users_space_test(Config) ->
  -    RestAddress = ?config(restAddress, Config),
  -    [Node] = ?config(gr_nodes, Config),
  -    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  -
  -    {ProviderId, ProviderReqParams} =
  -        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  -
  -    %% create users
  -    UserId = create_user(?USER_NAME1, Node),
  -    UserId2 = create_user(?USER_NAME2, Node),
  -
  -    %% authenticate users
  -    NewHeaders1 = auth_user(UserId, ProviderId, ReqParams, Node),
  -    NewHeaders2 = auth_user(UserId2, ProviderId, ReqParams, Node),
  -    UserReqParams1 = update_req_params(ProviderReqParams, NewHeaders1, headers),
  -    UserReqParams2 = update_req_params(ProviderReqParams, NewHeaders2, headers),
  -
  -    SID1 = create_space_for_user(?SPACE_NAME1, UserReqParams1),
  -
  -    SupportToken = get_space_support_token(SID1, UserReqParams1),
  -
  -    SupportResponse = provider_support_space(SupportToken, ?SPACE_SIZE1, ProviderReqParams),
  -
  -    ?assertMatch(ok, check_status(SupportResponse)),
  -
  -    InvitationToken = get_space_invitation_token(users, SID1, UserReqParams1),
  -
  -    SID2 = join_user_to_space(InvitationToken, UserReqParams2),
  -
  -    %% check if SID returned for user2 is the same as SID1
  -    ?assertMatch(SID1, SID2),
  +    ?assertMatch(SID1, join_user_to_space(InvitationToken, UserReqParams2)),
   
       %% check if space is in list of user2 space
       ?assertMatch([[SID1], <<"undefined">>], get_user_spaces(UserReqParams2)).
   
  -user_group_test(Config) ->
  -    RestAddress = ?config(restAddress, Config),
  -    [Node] = ?config(gr_nodes, Config),
  -    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  -    {ProviderId, ProviderReqParams} =
  -    register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  -
  -    %% create users
  -    UserId = create_user(?USER_NAME1, Node),
  -
  -    %% authenticate user
  -    NewHeaders = auth_user(UserId, ProviderId, ReqParams, Node),
  -    UserReqParams = update_req_params(ProviderReqParams, NewHeaders, headers),
  +user_create_group_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
   
       GID1 = create_group_for_user(?GROUP_NAME1, UserReqParams),
       GID2 = create_group_for_user(?GROUP_NAME2, UserReqParams),
   
  -    ?assertMatch(true, is_included([GID1, GID2], get_user_groups(UserReqParams))),
  -
  -    Response = user_leave_group(GID2,UserReqParams),
  -
  -    ?assertMatch(ok, check_status(Response)),
  -    ?assertMatch(false, is_included([GID2], get_user_groups(UserReqParams))),
  +    ?assertMatch(true, is_included([GID1, GID2], get_user_groups(UserReqParams))).
  +
  +user_get_group_data_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    GID1 = create_group_for_user(?GROUP_NAME1, UserReqParams),
       ?assertMatch([GID1, ?GROUP_NAME1], get_user_group(GID1, UserReqParams)).
   
  -many_users_group_test(Config) ->
  -    RestAddress = ?config(restAddress, Config),
  -    [Node] = ?config(gr_nodes, Config),
  -    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  -
  -    {ProviderId, ProviderReqParams} =
  -        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  -
  -    %% create users
  -    UserId1 = create_user(?USER_NAME1, Node),
  -    UserId2 = create_user(?USER_NAME2, Node),
  -
  -    %% authenticate users
  -    NewHeaders1 = auth_user(UserId1, ProviderId, ReqParams, Node),
  -    NewHeaders2 = auth_user(UserId2, ProviderId, ReqParams, Node),
  -    UserReqParams1 = update_req_params(ProviderReqParams, NewHeaders1, headers),
  -    UserReqParams2 = update_req_params(ProviderReqParams, NewHeaders2, headers),
  +user_leave_group_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    GID1 = create_group_for_user(?GROUP_NAME1, UserReqParams),
  +
  +    ?assertMatch(ok, check_status(user_leave_group(GID1,UserReqParams))),
  +    ?assertMatch(false, is_included([GID1], get_user_groups(UserReqParams))).
  +
  +user_group_invite_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {UserId1, UserReqParams1} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +    {UserId2, UserReqParams2} =
  +        register_user(?USER_NAME2, ProviderId, Config, ProviderReqParams),
   
       GID1 = create_group_for_user(?GROUP_NAME1, UserReqParams1),
   
       InvitationToken = get_group_invitation_token(GID1, UserReqParams1),
   
  -    GID2 = join_user_to_group(InvitationToken, UserReqParams2),
  -
       %% check if GID returned for user2 is the same as GID1
  -    ?assertMatch(GID1, GID2),
  -
  -    ?assertMatch([GID1, ?GROUP_NAME1], get_user_group(GID2, UserReqParams2)),
  +    ?assertMatch(GID1, join_user_to_group(InvitationToken, UserReqParams2)),
  +    ?assertMatch([GID1, ?GROUP_NAME1], get_user_group(GID1, UserReqParams2)),
       ?assertMatch(true, is_included([UserId1, UserId2], get_group_users(GID1, UserReqParams1))).
   
   %% group_rest_module_test_group =======================================
   
  -group_crud_test(Config) ->
  -    RestAddress = ?config(restAddress, Config),
  -    [Node] = ?config(gr_nodes, Config),
  -    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  -
  -    {ProviderId, ProviderReqParams} =
  -        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  -
  -     %% create users
  -    UserId = create_user(?USER_NAME1, Node),
  -
  -    %% authenticate user
  -    NewHeaders = auth_user(UserId, ProviderId, ReqParams, Node),
  -    UserReqParams = update_req_params(ProviderReqParams, NewHeaders, headers),
  -    
  -    %% create group
  +group_create_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
       GID = create_group(?GROUP_NAME1, UserReqParams),
   
  -    ?assertMatch([GID, ?GROUP_NAME1], read_group(GID, UserReqParams)),
  -
  -    UpdateResponse = update_group(GID, ?GROUP_NAME2, UserReqParams),
  -    ?assertMatch(ok, check_status(UpdateResponse)),
  -    ?assertMatch([GID, ?GROUP_NAME2], read_group(GID, UserReqParams)),
  -
  -    DeleteResponse = delete_group(GID, UserReqParams),
  -
  -    ?assertMatch(ok, check_status(DeleteResponse)),
  +    ?assertMatch([GID, ?GROUP_NAME1], read_group(GID, UserReqParams)).
  +
  +group_update_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    GID = create_group(?GROUP_NAME1, UserReqParams),
  +
  +    ?assertMatch(ok, check_status(update_group(GID, ?GROUP_NAME2, UserReqParams))),
  +    ?assertMatch([GID, ?GROUP_NAME2], read_group(GID, UserReqParams)).
  +
  +group_delete_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {_UserId, UserReqParams} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    GID = create_group(?GROUP_NAME1, UserReqParams),
  +
  +    ?assertMatch(ok, check_status(delete_group(GID, UserReqParams))),
       ?assertMatch(request_error, read_group(GID, UserReqParams)).
   
  -group_users_test(Config) ->
  -    RestAddress = ?config(restAddress, Config),
  -    [Node] = ?config(gr_nodes, Config),
  -    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  -
  -    {ProviderId, ProviderReqParams} =
  -        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  -
  -     %% create users
  -    UserId1 = create_user(?USER_NAME1, Node),
  -    UserId2 = create_user(?USER_NAME2, Node),
  -
  -    %% authenticate users
  -    NewHeaders = auth_user(UserId1, ProviderId, ReqParams, Node),
  -    UserReqParams1 = update_req_params(ProviderReqParams, NewHeaders, headers),
  -    NewHeaders2 = auth_user(UserId2, ProviderId, ReqParams, Node),
  -    UserReqParams2 = update_req_params(ProviderReqParams, NewHeaders2, headers),
  -
  -    GID1 = create_group(?GROUP_NAME1, UserReqParams1),
  -    
  -    ?assertMatch([UserId1, ?USER_NAME1], get_group_user(GID1, UserId1, UserReqParams1)),
  -    ?assertMatch([UserId1], get_group_users(GID1, UserReqParams1)),
  -
  -    Token = get_group_invitation_token(GID1, UserReqParams1),
  -    join_user_to_group(Token, UserReqParams2),
  -
  -    ?assertMatch(true, is_included([UserId1, UserId2], get_group_users(GID1, UserReqParams1))),
  -
  -    DeleteResponse = delete_group_user(GID1, UserId1, UserReqParams1),
  -
  -    ?assertMatch(ok, check_status(DeleteResponse)).
  -
  -group_privileges_test(Config) ->
  -    RestAddress = ?config(restAddress, Config),
  -    [Node] = ?config(gr_nodes, Config),
  -    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  -
  -    {ProviderId, ProviderReqParams} =
  -        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  -
  -     %% create users
  -    UserId1 = create_user(?USER_NAME1, Node),
  -    UserId2 = create_user(?USER_NAME2, Node),
  -    UserId3 = create_user(?USER_NAME3, Node),
  -
  -    %% authenticate users
  -    NewHeaders = auth_user(UserId1, ProviderId, ReqParams, Node),
  -    UserReqParams1 = update_req_params(ProviderReqParams, NewHeaders, headers),
  -    NewHeaders2 = auth_user(UserId2, ProviderId, ReqParams, Node),
  -    UserReqParams2 = update_req_params(ProviderReqParams, NewHeaders2, headers),
  -    NewHeaders3 = auth_user(UserId3, ProviderId, ReqParams, Node),
  -    UserReqParams3 = update_req_params(ProviderReqParams, NewHeaders3, headers),
  +group_invite_user_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {UserId1, UserReqParams1} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +    {UserId2, UserReqParams2} =
  +        register_user(?USER_NAME2, ProviderId, Config, ProviderReqParams),
  +
  +    GID = create_group(?GROUP_NAME1, UserReqParams1),
  +
  +    Token = get_group_invitation_token(GID, UserReqParams1),
  +    ?assertMatch(GID, join_user_to_group(Token, UserReqParams2)),
  +    ?assertMatch(true, is_included([UserId1, UserId2], get_group_users(GID, UserReqParams1))).
  +
  +group_get_user_data_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {UserId1, UserReqParams1} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    GID = create_group(?GROUP_NAME1, UserReqParams1),
  +
  +    ?assertMatch([UserId1, ?USER_NAME1], get_group_user(GID, UserId1, UserReqParams1)).
  +
  +group_delete_user_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {UserId1, UserReqParams1} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +
  +    GID = create_group(?GROUP_NAME1, UserReqParams1),
  +
  +    ?assertMatch(ok, check_status(delete_group_user(GID, UserId1, UserReqParams1))).
  +
  +group_get_privileges_test(Config) ->
  +    RestAddress = ?config(restAddress, Config),
  +    ReqParams = {RestAddress, ?CONTENT_TYPE_HEADER, []},
  +
  +    {ProviderId, ProviderReqParams} =
  +        register_provider(?URLS1, ?REDIRECTION_POINT1, ?CLIENT_NAME1, Config, ReqParams),
  +
  +    {UserId1, UserReqParams1} =
  +        register_user(?USER_NAME1, ProviderId, Config, ProviderReqParams),
  +    {UserId2, UserReqParams2} =
  +        register_user(?USER_NAME2, ProviderId, Config, ProviderReqParams),
   
       GID = create_group(?GROUP_NAME1, UserReqParams1),
   
  
positive.code:             provider_rest_module_test_group,
              [],
              [
                  provider_crud_test,
                  provider_space_test,
                  provider_check_test
              ]
          },
          {
              user_rest_module_test_group,
              [],
              [
                  user_crud_test,
                  user_space_test,
                  many_users_space_test,
                  user_group_test,
                  many_users_group_test
              ]
          },
          {
              group_rest_module_test_group,
              [],
              [
                  group_crud_test,
                  group_users_test,
                  group_privileges_test,
                  group_spaces_test
              ]
          }
          ,
          {
              spaces_rest_module_test_group,
              [],
              [
                  spaces_crud_by_user_test,
                  spaces_crud_by_provider_test,
                  spaces_user_test,
                  spaces_group_test,
                  spaces_provider_test,
                  spaces_privileges_test
              ]
          }
      ].
  
negative.code:     Resp = do_request(RestAddress ++ "/user/authorize", Headers, post, Body),
      {ok, _, _, SerializedDischarges} = Resp,
      prepare_macaroons_headers(SerializedMacaroon, SerializedDischarges).
  
  register_user(UserName, ProviderId, Config, ProviderReqParams) ->
      [Node] = ?config(gr_nodes, Config),
      UserId = create_user(UserName, Node),
      NewHeaders = auth_user(UserId, ProviderId, ProviderReqParams, Node),
      UserReqParams = update_req_params(ProviderReqParams, NewHeaders, headers),
      {UserId, UserReqParams}.
  
  read_user(ReqParams) ->
      {RestAddress, Headers, Options} = ReqParams,
      Response = do_request(RestAddress ++ "/user", Headers, get,[], Options),
      get_body_val([userId, name], Response).
  
  update_user(NewUserName, ReqParams) ->
      {RestAddress, Headers, Options} = ReqParams,
      Body = jiffy:encode({[
          {name, NewUserName}
      ]}),
      do_request(RestAddress ++ "/user", Headers, patch, Body, Options).
  
  delete_user(ReqParams) ->
       {RestAddress, Headers, Options} = ReqParams,
       do_request(RestAddress ++ "/user", Headers, delete, [], Options).
  
  get_user_spaces(ReqParams) ->
      {RestAddress, Headers, Options} = ReqParams,
      Response = do_request(RestAddress ++ "/user/spaces", Headers, get, [], Options),
      get_body_val([spaces, default], Response).
  
  get_user_space(SID, ReqParams) ->
      {RestAddress, Headers, Options} = ReqParams,
      Response =
          do_request(RestAddress ++ "/user/spaces/" ++ binary_to_list(SID), Headers, get, [], Options),
      get_body_val([spaceId, name], Response).
  
  get_user_default_space(ReqParams) ->
      {RestAddress, Headers, Options} = ReqParams,
      Response = do_request(RestAddress ++ "/user/spaces/default", Headers, get, [], Options),
      [DefSpace] = get_body_val([spaceId], Response),
      DefSpace.
  
  create_space_for_user(SpaceName, ReqParams) ->
      {RestAddress, Headers, Options} = ReqParams,
      Body = jiffy:encode({[
          {name, SpaceName}
      ]}),
      Response = do_request(RestAddress ++ "/user/spaces", Headers, post, Body, Options),
      get_header_val("spaces", Response).
  
  set_default_space_for_user(SID, ReqParams) ->
      {RestAddress, Headers, Options} = ReqParams,
      Body = jiffy:encode({[
          {spaceId, SID}
      ]}),
      do_request(RestAddress ++ "/user/spaces/default", Headers, put, Body, Options).
  
  get_user_merge_token(ReqParams) ->
      {RestAddress, Headers, Options} = ReqParams,
      Response = do_request(RestAddress ++ "/user/merge/token", Headers, get, [], Options),
      [Token] = get_body_val([token], Response),
      Token.
  
  merge_users(Token, ReqParams) ->
      {RestAddress, Headers, Options} = ReqParams,
       Body = jiffy:encode({[
          {token, Token}
      ]}),
      do_request(RestAddress ++ "/user/merge", Headers, post, Body, Options).
  
  delete_user_space(SID, ReqParams) ->
      {RestAddress, Headers, Options} = ReqParams,
      do_request(RestAddress ++ "/user/spaces/" ++ binary_to_list(SID), Headers, delete, [], Options).
  
  join_user_to_space(Token, ReqParams) ->
      {RestAddress, Headers, Options} = ReqParams,
  