mirror of
https://github.com/processone/ejabberd.git
synced 2024-10-13 15:16:49 +02:00
Add tests for mod_announce
This commit is contained in:
parent
a087af7060
commit
abeaac1c11
@ -206,6 +206,8 @@ db_tests(riak) ->
|
||||
[offline_master, offline_slave]},
|
||||
{test_muc, [parallel],
|
||||
[muc_master, muc_slave]},
|
||||
{test_announce, [parallel],
|
||||
[announce_master, announce_slave]},
|
||||
{test_roster_remove, [parallel],
|
||||
[roster_remove_master,
|
||||
roster_remove_slave]}];
|
||||
@ -233,6 +235,8 @@ db_tests(mnesia) ->
|
||||
[carbons_master, carbons_slave]},
|
||||
{test_muc, [parallel],
|
||||
[muc_master, muc_slave]},
|
||||
{test_announce, [parallel],
|
||||
[announce_master, announce_slave]},
|
||||
{test_roster_remove, [parallel],
|
||||
[roster_remove_master,
|
||||
roster_remove_slave]}];
|
||||
@ -259,6 +263,8 @@ db_tests(_) ->
|
||||
[offline_master, offline_slave]},
|
||||
{test_muc, [parallel],
|
||||
[muc_master, muc_slave]},
|
||||
{test_announce, [parallel],
|
||||
[announce_master, announce_slave]},
|
||||
{test_roster_remove, [parallel],
|
||||
[roster_remove_master,
|
||||
roster_remove_slave]}].
|
||||
@ -1273,6 +1279,39 @@ muc_slave(Config) ->
|
||||
role = none}]}]} = recv(),
|
||||
disconnect(Config).
|
||||
|
||||
announce_master(Config) ->
|
||||
MyJID = my_jid(Config),
|
||||
ServerJID = server_jid(Config),
|
||||
Peer = ?config(slave, Config),
|
||||
MotdJID = jlib:jid_replace_resource(ServerJID, <<"announce/motd">>),
|
||||
MotdDelJID = jlib:jid_replace_resource(ServerJID, <<"announce/motd/delete">>),
|
||||
MotdText = #text{data = <<"motd">>},
|
||||
send(Config, #presence{}),
|
||||
#presence{from = MyJID} = recv(),
|
||||
%% Set message of the day
|
||||
send(Config, #message{to = MotdJID, body = [MotdText]}),
|
||||
%% Receive this message back
|
||||
#message{from = ServerJID, body = [MotdText]} = recv(),
|
||||
wait_for_slave(Config),
|
||||
%% Peer becomes available and then unavailable
|
||||
#presence{from = Peer} = recv(),
|
||||
#presence{from = Peer, type = unavailable} = recv(),
|
||||
%% Delete message of the day
|
||||
send(Config, #message{to = MotdDelJID}),
|
||||
disconnect(Config).
|
||||
|
||||
announce_slave(Config) ->
|
||||
MyJID = my_jid(Config),
|
||||
ServerJID = server_jid(Config),
|
||||
Peer = ?config(master, Config),
|
||||
MotdText = #text{data = <<"motd">>},
|
||||
wait_for_master(Config),
|
||||
send(Config, #presence{}),
|
||||
?recv3(#presence{from = Peer},
|
||||
#presence{from = MyJID},
|
||||
#message{from = ServerJID, body = [MotdText]}),
|
||||
disconnect(Config).
|
||||
|
||||
offline_master(Config) ->
|
||||
Peer = ?config(slave, Config),
|
||||
LPeer = jlib:jid_remove_resource(Peer),
|
||||
|
@ -11,6 +11,7 @@ host_config:
|
||||
modules:
|
||||
mod_announce:
|
||||
db_type: odbc
|
||||
access: local
|
||||
mod_blocking:
|
||||
db_type: odbc
|
||||
mod_caps:
|
||||
@ -64,6 +65,7 @@ Welcome to this XMPP server."
|
||||
modules:
|
||||
mod_announce:
|
||||
db_type: odbc
|
||||
access: local
|
||||
mod_blocking:
|
||||
db_type: odbc
|
||||
mod_caps:
|
||||
@ -110,6 +112,7 @@ Welcome to this XMPP server."
|
||||
modules:
|
||||
mod_announce:
|
||||
db_type: internal
|
||||
access: local
|
||||
mod_blocking:
|
||||
db_type: internal
|
||||
mod_caps:
|
||||
@ -158,6 +161,7 @@ Welcome to this XMPP server."
|
||||
modules:
|
||||
mod_announce:
|
||||
db_type: riak
|
||||
access: local
|
||||
mod_blocking:
|
||||
db_type: riak
|
||||
mod_caps:
|
||||
|
Loading…
Reference in New Issue
Block a user