anchor.diff:  -define(SH, "DirectIO").
   -define(TEST_ROOT, "/tmp/veilfs/"). %% Root of test filesystem
   -define(SH2, "ClusterProxy").
  +
  +perms_test_() ->
  +  {foreach, fun setup/0, fun teardown/1, [fun check_perms_user_file/0, fun check_perms_read_group_file/0, fun check_perms_group_perms_file/0, fun check_perms_group_write_file/0]}.
  +
  +setup() ->
  +  meck:new(fslogic),
  +  meck:new(veilhelpers),
  +  meck:new(fslogic_utils).
  +
  +teardown(_) ->
  +  meck:unload(fslogic_utils),
  +  meck:unload(veilhelpers),
  +  meck:unload(fslogic).
   
   %% This test checks if data from helpers is cached
   file_name_cache_test() ->
  
positive.code:   meck:expect(fslogic, get_user_groups, fun(_, _) -> {error, error} end),
    ?assertEqual({error, can_not_get_user_groups}, storage_files_manager:check_perms("groups/testgroup/somefile", SHInfo, read)),
  
    ?assert(meck:validate(fslogic)),
    meck:unload(fslogic).
  
  %% Tests if permissions to modify file's attributes in groups dir are checked correctly
  check_perms_group_perms_file_test() ->
    SHInfo = #storage_helper_info{name = ?SH, init_args = [?TEST_ROOT]},
    meck:new(fslogic),
    meck:new(veilhelpers),
    meck:new(fslogic_utils),
  
    meck:expect(fslogic, get_user_doc, fun() -> {ok, #veil_document{record = #user{login = "testuser"}}} end),
    meck:expect(fslogic, get_user_groups, fun(_, _) -> {ok, [xyz, abc, "testgroup", g123]} end),
  
negative.code:   ?assertEqual({error, can_not_check_grp_perms}, storage_files_manager:check_perms("groups/testgroup/somefile", SHInfo)),
  
    ?assert(meck:validate(fslogic_utils)),
    ?assert(meck:validate(fslogic)),
    ?assert(meck:validate(veilhelpers)).