anchor.diff:    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).
  +  ?assert(meck:validate(fslogic)).
   
   %% Tests if permissions to modify file's attributes in groups dir are checked correctly
  -check_perms_group_perms_file_test() ->
  +check_perms_group_perms_file() ->
     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),
  
positive.code:   ?assertEqual({error, too_short_path}, storage_files_manager:check_perms("something", SHInfo)).
  
  %% Tests if write permissions in groups dir are checked correctly
  check_perms_group_write_file_test() ->
    SHInfo = #storage_helper_info{name = ?SH, init_args = [?TEST_ROOT]},
    meck:new(fslogic),
    meck:new(veilhelpers),
    meck:new(fslogic_utils),
  
    EtsName = logical_files_manager:get_ets_name(),
    ets:delete(EtsName),
    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),
    meck:expect(veilhelpers, exec, fun(getattr, _, _) -> {0, #st_stat{st_uid = 1000, st_mode = 8#660}} end),
    ?assertEqual({ok, true}, storage_files_manager:check_perms("groups/testgroup/somefile", SHInfo)),
  
    ets:delete(EtsName),
    meck:expect(fslogic_utils, get_user_id_from_system, fun
      ("testuser") -> "1000\n";
  
negative.code: -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() ->
  