Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sylane committed Oct 8, 2024
1 parent 564f9c3 commit 00d3983
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/rebar3_grisp_io_api.erl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ auth(RState, Username, Password) ->
Res :: ok | no_return().
update_package(RState, Token, PackageName, PackagePath, Force) ->
BaseUrl = base_url(RState),
URI = list_to_binary("/grisp-manager/api/update-package/" ++ PackageName),
URI = <<"/grisp-manager/api/update-package/", PackageName/binary>>,
Url = <<BaseUrl/binary, URI/binary>>,
BinSize = filelib:file_size(PackagePath),
Etag = <<"\"", PackageName/binary, "\"">>,
Expand Down
3 changes: 2 additions & 1 deletion test/rebar3_grisp_io_deploy_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ run_deploy(Config) ->
setup_meck_io() ->
ok = meck:new(rebar3_grisp_io_io, [no_link]),
ok = meck:expect(rebar3_grisp_io_io, ask, fun fake_ask/2),
ok = meck:expect(rebar3_grisp_io_io, console, fun (_, _) -> ok end),
ok = meck:expect(rebar3_grisp_io_io, abort, 2, fun (_, [E, S]) -> ct:pal(error, "Error Stack: ~p", [S]), ct:fail("Fail: ~p", [E]) end),
ok = meck:expect(rebar3_grisp_io_io, abort, 1,
fun(Msg) ->
Expand All @@ -87,7 +88,7 @@ setup_meck_io() ->

setup_meck_gio_utils() ->
ok = meck:new(rebar3_grisp_io_utils, [no_link, passthrough]),
ok = meck:expect(rebar3_grisp_io_utils, grisp_pack, fun(RState, _) -> {ok, RState} end).
ok = meck:expect(rebar3_grisp_io_utils, grisp_pack, fun(RState, _, _) -> {ok, RState} end).

fake_ask("Local password", _) ->
<<"azerty">>.
7 changes: 4 additions & 3 deletions test/rebar3_grisp_io_upload_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ end_per_testcase(_, _Config) ->

run_upload(Config) ->
RState = ?config(rebar_state, Config),
RState1 = rebar_state:dir(RState, ?config(data_dir, Config)),
RState1 = rebar_state:set(RState, root_dir, ?config(data_dir, Config)),

ProviderOutput = rebar3_grisp_io_test_utils:run_grisp_io_command(RState1,
?PROV,
Expand All @@ -64,15 +64,16 @@ run_upload(Config) ->
setup_meck_io() ->
ok = meck:new(rebar3_grisp_io_io, [no_link]),
ok = meck:expect(rebar3_grisp_io_io, ask, fun fake_ask/2),
ok = meck:expect(rebar3_grisp_io_io, console, fun (_, _) -> ok end),
ok = meck:expect(rebar3_grisp_io_io, abort, 2, fun (_, [E, S]) -> ct:pal(error, "Error Stack: ~p", [S]), ct:fail("Fail: ~p", [E]) end),
ok = meck:expect(rebar3_grisp_io_io, abort, 1, fun (Msg) ->
ct:fail(Msg)
end),
ok = meck:expect(rebar3_grisp_io_io, success, 1, fun (_) -> ok end).
ok = meck:expect(rebar3_grisp_io_io, success, 2, fun (_, _) -> ok end).

setup_meck_gio_utils() ->
ok = meck:new(rebar3_grisp_io_utils, [no_link, passthrough]),
ok = meck:expect(rebar3_grisp_io_utils, grisp_pack, fun(RState, _) -> {ok, RState} end).
ok = meck:expect(rebar3_grisp_io_utils, grisp_pack, fun(RState, _, _) -> {ok, RState} end).

fake_ask("Local password", _) ->
<<"azerty">>.
3 changes: 2 additions & 1 deletion test/rebar3_grisp_io_validate_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ run_validate(Config) ->
setup_meck_io() ->
ok = meck:new(rebar3_grisp_io_io, [no_link]),
ok = meck:expect(rebar3_grisp_io_io, ask, fun fake_ask/2),
ok = meck:expect(rebar3_grisp_io_io, console, fun (_, _) -> ok end),
ok = meck:expect(rebar3_grisp_io_io, abort, 2, fun (_, [E, S]) -> ct:pal(error, "Error Stack: ~p", [S]), ct:fail("Fail: ~p", [E]) end),
ok = meck:expect(rebar3_grisp_io_io, abort, 1,
fun(Msg) ->
Expand All @@ -86,7 +87,7 @@ setup_meck_io() ->

setup_meck_gio_utils() ->
ok = meck:new(rebar3_grisp_io_utils, [no_link, passthrough]),
ok = meck:expect(rebar3_grisp_io_utils, grisp_pack, fun(RState, _) -> {ok, RState} end).
ok = meck:expect(rebar3_grisp_io_utils, grisp_pack, fun(RState, _, _) -> {ok, RState} end).

fake_ask("Local password", _) ->
<<"azerty">>.

0 comments on commit 00d3983

Please sign in to comment.