Skip to content

Commit

Permalink
Test: Update to the new webadmin pages
Browse files Browse the repository at this point in the history
  • Loading branch information
badlop committed Jun 19, 2024
1 parent 5a34020 commit 4819baa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions test/ejabberd_SUITE_data/ejabberd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ max_fsm_queue: 1000
queue_type: file
modules:
mod_adhoc: []
mod_admin_extra: []
mod_admin_update_sql: []
mod_announce: []
mod_configure: []
Expand Down
15 changes: 8 additions & 7 deletions test/webadmin_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ adduser(Config) ->
Body = make_query(
Config,
"server/" ++ binary_to_list(Server) ++ "/users/",
<<"newusername=", (mue(User))/binary, "&newuserpassword=",
(mue(Password))/binary, "&addnewuser=Add+User">>),
<<"register/user=", (mue(User))/binary, "&register/password=",
(mue(Password))/binary, "&register=Register">>),
Password = ejabberd_auth:get_password(User, Server),
?match({_, _}, binary:match(Body, <<"<a href='../user/">>)).
?match({_, _}, binary:match(Body, <<"User ", User/binary, "@", Server/binary,
" successfully registered">>)).

changepassword(Config) ->
User = <<"userwebadmin-", (?config(user, Config))/binary>>,
Expand All @@ -89,10 +90,10 @@ changepassword(Config) ->
Config,
"server/" ++ binary_to_list(Server)
++ "/user/" ++ binary_to_list(mue(User)) ++ "/",
<<"password=", (mue(Password))/binary,
"&chpassword=Change+Password">>),
<<"change_password/newpass=", (mue(Password))/binary,
"&change_password=Change+Password">>),
?match(Password, ejabberd_auth:get_password(User, Server)),
?match({_, _}, binary:match(Body, <<"<p class='result'>Submitted</p>">>)).
?match({_, _}, binary:match(Body, <<"<div class='result'><code>ok</code></div>">>)).

removeuser(Config) ->
User = <<"userwebadmin-", (?config(user, Config))/binary>>,
Expand All @@ -101,7 +102,7 @@ removeuser(Config) ->
Config,
"server/" ++ binary_to_list(Server)
++ "/user/" ++ binary_to_list(mue(User)) ++ "/",
<<"password=&removeuser=Remove+User">>),
<<"&unregister=Unregister">>),
false = ejabberd_auth:user_exists(User, Server),
?match(nomatch, binary:match(Body, <<"<h3>Last Activity</h3>20">>)).

Expand Down

0 comments on commit 4819baa

Please sign in to comment.