test(authn): fix test case
This commit is contained in:
parent
d409cb83ff
commit
87051c0e53
|
@ -33,7 +33,7 @@ end_per_suite(_Config) ->
|
|||
emqx_ct_helpers:stop_apps([]).
|
||||
|
||||
t_authenticate(_) ->
|
||||
?assertMatch(ok, emqx_access_control:authenticate(clientinfo())).
|
||||
?assertMatch({ok, _}, emqx_access_control:authenticate(clientinfo())).
|
||||
|
||||
t_authorize(_) ->
|
||||
Publish = ?PUBLISH_PACKET(?QOS_0, <<"t">>, 1, <<"payload">>),
|
||||
|
|
|
@ -181,7 +181,7 @@ init_per_suite(Config) ->
|
|||
%% Access Control Meck
|
||||
ok = meck:new(emqx_access_control, [passthrough, no_history, no_link]),
|
||||
ok = meck:expect(emqx_access_control, authenticate,
|
||||
fun(_) -> ok end),
|
||||
fun(_) -> {ok, #{superuser => false}} end),
|
||||
ok = meck:expect(emqx_access_control, authorize, fun(_, _, _) -> allow end),
|
||||
%% Broker Meck
|
||||
ok = meck:new(emqx_broker, [passthrough, no_history, no_link]),
|
||||
|
|
|
@ -73,7 +73,7 @@ authenticate(_Ctx = #{auth := ChainId}, ClientInfo0) ->
|
|||
chain_id => ChainId
|
||||
},
|
||||
case emqx_access_control:authenticate(ClientInfo) of
|
||||
ok ->
|
||||
{ok, _} ->
|
||||
{ok, mountpoint(ClientInfo)};
|
||||
{error, Reason} ->
|
||||
{error, Reason}
|
||||
|
|
|
@ -87,7 +87,7 @@ init(CoapPid, EndpointName, Peername = {_Peerhost, _Port}, RegInfo = #{<<"lt">>
|
|||
ClientInfo = clientinfo(Lwm2mState),
|
||||
_ = run_hooks('client.connect', [conninfo(Lwm2mState)], undefined),
|
||||
case emqx_access_control:authenticate(ClientInfo) of
|
||||
ok ->
|
||||
{ok, _} ->
|
||||
_ = run_hooks('client.connack', [conninfo(Lwm2mState), success], undefined),
|
||||
|
||||
%% FIXME:
|
||||
|
|
Loading…
Reference in New Issue