mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Add integration test for set_room_affiliation
This commit is contained in:
parent
a58de70f06
commit
c69720a1ab
@ -450,6 +450,8 @@ listen:
|
||||
port: @@web_port@@
|
||||
module: ejabberd_http
|
||||
captcha: true
|
||||
request_handlers:
|
||||
"/api": mod_http_api
|
||||
-
|
||||
port: @@component_port@@
|
||||
module: ejabberd_service
|
||||
@ -466,6 +468,7 @@ modules:
|
||||
mod_proxy65: []
|
||||
mod_legacy: []
|
||||
mod_muc: []
|
||||
mod_muc_admin: []
|
||||
mod_register:
|
||||
welcome_message:
|
||||
subject: "Welcome!"
|
||||
@ -488,3 +491,8 @@ outgoing_s2s_port: @@s2s_port@@
|
||||
shaper:
|
||||
fast: 50000
|
||||
normal: 10000
|
||||
|
||||
api_permissions:
|
||||
"public commands":
|
||||
who: all
|
||||
what: "*"
|
||||
|
@ -53,7 +53,8 @@ single_cases() ->
|
||||
single_test(service_vcard),
|
||||
single_test(configure_non_existent),
|
||||
single_test(cancel_configure_non_existent),
|
||||
single_test(service_subscriptions)]}.
|
||||
single_test(service_subscriptions),
|
||||
single_test(set_room_affiliation)]}.
|
||||
|
||||
service_presence_error(Config) ->
|
||||
Service = muc_jid(Config),
|
||||
@ -242,6 +243,32 @@ service_subscriptions(Config) ->
|
||||
end, Rooms),
|
||||
disconnect(Config).
|
||||
|
||||
set_room_affiliation(Config) ->
|
||||
#jid{server = RoomService} = muc_jid(Config),
|
||||
RoomName = <<"set_room_affiliation">>,
|
||||
RoomJID = jid:make(RoomName, RoomService),
|
||||
MyJID = my_jid(Config),
|
||||
PeerJID = jid:remove_resource(?config(slave, Config)),
|
||||
|
||||
ct:pal("joining room ~p", [RoomJID]),
|
||||
ok = join_new(Config, RoomJID),
|
||||
|
||||
ct:pal("setting affiliation in room ~p to 'member' for ~p", [RoomJID, PeerJID]),
|
||||
ServerHost = ?config(server_host, Config),
|
||||
WebPort = ct:get_config(web_port, 5280),
|
||||
RequestURL = "http://" ++ ServerHost ++ ":" ++ integer_to_list(WebPort) ++ "/api/set_room_affiliation",
|
||||
Headers = [{"X-Admin", "true"}],
|
||||
ContentType = "application/json",
|
||||
Body = jiffy:encode(#{name => RoomName, service => RoomService, jid => jid:encode(PeerJID), affiliation => member}),
|
||||
{ok, {{_, 200, _}, _, _}} = httpc:request(post, {RequestURL, Headers, ContentType, Body}, [], []),
|
||||
|
||||
#message{id = _, from = RoomJID, to = MyJID, sub_els = [
|
||||
#muc_user{items = [
|
||||
#muc_item{affiliation = member, role = none, jid = PeerJID}]}]} = recv_message(Config),
|
||||
|
||||
ok = leave(Config, RoomJID),
|
||||
disconnect(Config).
|
||||
|
||||
%%%===================================================================
|
||||
%%% Master-slave tests
|
||||
%%%===================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user