summaryrefslogtreecommitdiff
path: root/test/rebar_pkg_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'test/rebar_pkg_SUITE.erl')
-rw-r--r--test/rebar_pkg_SUITE.erl22
1 files changed, 11 insertions, 11 deletions
diff --git a/test/rebar_pkg_SUITE.erl b/test/rebar_pkg_SUITE.erl
index ee74af5..ad06abd 100644
--- a/test/rebar_pkg_SUITE.erl
+++ b/test/rebar_pkg_SUITE.erl
@@ -99,7 +99,7 @@ init_per_testcase(bad_disconnect=Name, Config0) ->
Config = mock_config(Name, Config1),
meck:expect(hex_repo, get_tarball, fun(_, _, _) ->
{error, econnrefused}
- end),
+ end),
Config;
init_per_testcase(Name, Config0) ->
Config = [{good_cache, false},
@@ -252,7 +252,7 @@ mock_config(Name, Config) ->
CacheRoot = filename:join([Priv, "cache", atom_to_list(Name)]),
TmpDir = filename:join([Priv, "tmp", atom_to_list(Name)]),
Tid = ets:new(registry_table, [public]),
- AllDeps = [
+ AllDeps = [
{{<<"badindexchk">>,<<"1.0.0">>}, [[], ?bad_checksum, [<<"rebar3">>]]},
{{<<"goodpkg">>,<<"1.0.0">>}, [[], ?good_checksum, [<<"rebar3">>]]},
{{<<"goodpkg">>,<<"1.0.1">>}, [[], ?good_checksum, [<<"rebar3">>]]},
@@ -267,7 +267,7 @@ mock_config(Name, Config) ->
ok = ets:tab2file(Tid, filename:join([CacheDir, "registry"])),
catch ets:delete(?PACKAGE_TABLE),
- rebar_packages:new_package_table(),
+ rebar_packages:new_package_table(),
lists:foreach(fun({{N, Vsn}, [Deps, Checksum, _]}) ->
case ets:member(?PACKAGE_TABLE, {ec_cnv:to_binary(N), Vsn, <<"hexpm">>}) of
false ->
@@ -279,18 +279,18 @@ mock_config(Name, Config) ->
ok
end
end, AllDeps),
-
+
meck:new(hex_repo, [passthrough]),
- meck:expect(hex_repo, get_package,
+ meck:expect(hex_repo, get_package,
fun(_Config, PkgName) ->
Matches = ets:match_object(Tid, {{PkgName,'_'}, '_'}),
- Releases =
+ Releases =
[#{checksum => Checksum,
version => Vsn,
- dependencies => Deps} ||
+ dependencies => Deps} ||
{{_, Vsn}, [Deps, Checksum, _]} <- Matches],
- {ok, {200, #{}, #{releases => Releases}}}
+ {ok, {200, #{}, Releases}}
end),
%% The state returns us a fake registry
@@ -321,7 +321,7 @@ mock_config(Name, Config) ->
%% Cache fetches are mocked -- we assume the server and clients are
%% correctly used.
GoodCache = ?config(good_cache, Config),
- {Pkg,Vsn} = ?config(pkg, Config),
+ {Pkg,Vsn} = ?config(pkg, Config),
PkgFile = <<Pkg/binary, "-", Vsn/binary, ".tar">>,
{ok, PkgContents} = file:read_file(filename:join(?config(data_dir, Config), PkgFile)),
@@ -329,8 +329,8 @@ mock_config(Name, Config) ->
{ok, {304, #{<<"etag">> => ?good_etag}, <<>>}};
(_, _, _) ->
{ok, {200, #{<<"etag">> => ?good_etag}, PkgContents}}
- end),
-
+ end),
+
[{cache_root, CacheRoot},
{cache_dir, CacheDir},
{tmp_dir, TmpDir},