From 2a866e7c91aa5b7f0bf997869b722d19f2a16e37 Mon Sep 17 00:00:00 2001 From: JimMoen Date: Mon, 14 Mar 2022 18:18:16 +0800 Subject: [PATCH] test(authn_api): move authn resource position --- apps/emqx_authn/test/emqx_authn_api_SUITE.erl | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/apps/emqx_authn/test/emqx_authn_api_SUITE.erl b/apps/emqx_authn/test/emqx_authn_api_SUITE.erl index b0aced062..ce4912f03 100644 --- a/apps/emqx_authn/test/emqx_authn_api_SUITE.erl +++ b/apps/emqx_authn/test/emqx_authn_api_SUITE.erl @@ -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) ->