test(authn_api): move authn resource position

This commit is contained in:
JimMoen 2022-03-14 18:18:16 +08:00
parent e96bbf5c8b
commit 2a866e7c91
1 changed files with 19 additions and 2 deletions

View File

@ -347,7 +347,7 @@ test_authenticator_move(PathPrefix) ->
],
PathPrefix ++ [?CONF_NS]),
% Invalid moves
%% Invalid moves
{ok, 400, _} = request(
post,
@ -374,8 +374,9 @@ test_authenticator_move(PathPrefix) ->
uri(PathPrefix ++ [?CONF_NS, "jwt", "move"]),
#{position => <<"before:password_based:redis">>}),
% Valid moves
%% Valid moves
%% test top
{ok, 204, _} = request(
post,
uri(PathPrefix ++ [?CONF_NS, "jwt", "move"]),
@ -389,6 +390,7 @@ test_authenticator_move(PathPrefix) ->
],
PathPrefix ++ [?CONF_NS]),
%% test bottom
{ok, 204, _} = request(
post,
uri(PathPrefix ++ [?CONF_NS, "jwt", "move"]),
@ -402,6 +404,7 @@ test_authenticator_move(PathPrefix) ->
],
PathPrefix ++ [?CONF_NS]),
%% test before
{ok, 204, _} = request(
post,
uri(PathPrefix ++ [?CONF_NS, "jwt", "move"]),
@ -413,6 +416,20 @@ test_authenticator_move(PathPrefix) ->
#{<<"mechanism">> := <<"jwt">>},
#{<<"mechanism">> := <<"password_based">>, <<"backend">> := <<"built_in_database">>}
],
PathPrefix ++ [?CONF_NS]),
%% test after
{ok, 204, _} = request(
post,
uri(PathPrefix ++ [?CONF_NS, "password_based%3Abuilt_in_database", "move"]),
#{position => <<"after:password_based:http">>}),
?assertAuthenticatorsMatch(
[
#{<<"mechanism">> := <<"password_based">>, <<"backend">> := <<"http">>},
#{<<"mechanism">> := <<"password_based">>, <<"backend">> := <<"built_in_database">>},
#{<<"mechanism">> := <<"jwt">>}
],
PathPrefix ++ [?CONF_NS]).
test_authenticator_import_users(PathPrefix) ->