test(gateway): fix meck unload error and reformat some codes

This commit is contained in:
firest 2022-04-08 13:36:57 +08:00
parent 786be82d07
commit 7f1bec5d78
3 changed files with 10 additions and 9 deletions

View File

@ -136,8 +136,8 @@ on_start_auth(authn_http) ->
%% set handler for test server %% set handler for test server
Handler = fun(Req0, State) -> Handler = fun(Req0, State) ->
ct:pal("Authn Req:~p~nState:~p~n", [Req0, State]), ct:pal("Authn Req:~p~nState:~p~n", [Req0, State]),
case cowboy_req:match_qs([username, password], Req0) of case cowboy_req:match_qs([username, password], Req0) of
#{ #{
username := <<"admin">>, username := <<"admin">>,
password := <<"public">> password := <<"public">>
@ -154,8 +154,8 @@ on_start_auth(authn_http) ->
on_stop_auth(authn_http) -> on_stop_auth(authn_http) ->
Delete = fun(Gateway) -> Delete = fun(Gateway) ->
Path = io_lib:format("/gateway/~ts/authentication", [Gateway]), Path = io_lib:format("/gateway/~ts/authentication", [Gateway]),
{204, _} = request(delete, Path) {204, _} = request(delete, Path)
end, end,
lists:foreach(Delete, ?GATEWAYS), lists:foreach(Delete, ?GATEWAYS),
ok = emqx_authn_http_test_server:stop(). ok = emqx_authn_http_test_server:stop().

View File

@ -93,11 +93,11 @@ end_per_testcase(_Case, Config) ->
t_case_coap(_) -> t_case_coap(_) ->
Login = fun(URI, Checker) -> Login = fun(URI, Checker) ->
Action = fun(Channel) -> Action = fun(Channel) ->
Req = emqx_coap_SUITE:make_req(post), Req = emqx_coap_SUITE:make_req(post),
Checker(emqx_coap_SUITE:do_request(Channel, URI, Req)) Checker(emqx_coap_SUITE:do_request(Channel, URI, Req))
end, end,
emqx_coap_SUITE:do(Action) emqx_coap_SUITE:do(Action)
end, end,
Prefix = emqx_coap_SUITE:mqtt_prefix(), Prefix = emqx_coap_SUITE:mqtt_prefix(),
RightUrl = RightUrl =

View File

@ -42,6 +42,7 @@ init_per_suite(Conf) ->
Conf. Conf.
end_per_suite(_Conf) -> end_per_suite(_Conf) ->
meck:unload(emqx_access_control),
ok. ok.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------