anchor.diff:  -module(file_upload_test_SUITE).
   -author("Bartosz Walkowicz").
   
  +-include("modules/fslogic/fslogic_common.hrl").
   -include_lib("ctool/include/aai/aai.hrl").
   -include_lib("ctool/include/logging.hrl").
   -include_lib("ctool/include/api_errors.hrl").
  
positive.code: 
  
  init_per_testcase(Case, Config) when
      Case =:= not_registered_upload_should_fail
  ->
      Workers = ?config(op_worker_nodes, Config),
      ok = test_utils:mock_new(Workers, cow_multipart),
      ok = test_utils:mock_new(Workers, cowboy_req),
      ok = test_utils:mock_expect(Workers, cow_multipart, form_data,
          fun(_) -> {file, ok, ok, ok} end
      ),
  
negative.code:     ok = test_utils:mock_expect(Workers, cowboy_req, read_part_body,
          fun
              (#{left := 1, size := Size} = Req, _) ->
                  {ok, << <<$a>> || _ <- lists:seq(1, Size) >>, Req#{done => true}};
              (#{left := Left, size := Size} = Req, _) ->
                  {more, << <<$a>> || _ <- lists:seq(1, Size) >>, Req#{left => Left-1}}
          end
      ),
      init_per_testcase(default, Config);
  