summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2018-06-19 21:31:11 +0200
committerlouiz’ <louiz@louiz.org>2018-06-19 21:33:33 +0200
commit21a79b7bad51e755cee2890aa6d0bec5dd45f901 (patch)
tree2cb8613bd3f2ecd5d94e4e540baa721ab221a50e /tests
parentfc17ee078f9966a73e0b919cf2826726cbc08e1f (diff)
downloadbiboumi-21a79b7bad51e755cee2890aa6d0bec5dd45f901.tar.gz
biboumi-21a79b7bad51e755cee2890aa6d0bec5dd45f901.tar.bz2
biboumi-21a79b7bad51e755cee2890aa6d0bec5dd45f901.tar.xz
biboumi-21a79b7bad51e755cee2890aa6d0bec5dd45f901.zip
Reject messages from unjoined resources, with an error
fix #3346
Diffstat (limited to 'tests')
-rw-r--r--tests/end_to_end/__main__.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py
index 5611e8d..60e868b 100644
--- a/tests/end_to_end/__main__.py
+++ b/tests/end_to_end/__main__.py
@@ -1404,6 +1404,32 @@ if __name__ == '__main__':
"/message[@from='{lower_nick_two}%{irc_server_one}'][@to='{jid_one}/{resource_one}']"),
]
),
+ Scenario("muc_message_from_unjoined_resource",
+ [
+ handshake_sequence(),
+ partial(send_stanza,
+ "<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"),
+ connection_sequence("irc.localhost", '{jid_one}/{resource_one}'),
+ partial(expect_stanza,
+ "/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"),
+ partial(expect_stanza, "/presence"),
+ partial(expect_stanza, "/message/subject"),
+
+ # Send a channel message
+ partial(send_stanza, "<message from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}' type='groupchat'><body>coucou</body></message>"),
+ # Receive the message
+ partial(expect_stanza,
+ ("/message[@from='#foo%{irc_server_one}/{nick_one}'][@to='{jid_one}/{resource_one}'][@type='groupchat']/body[text()='coucou']",
+ "/message/stable_id:stanza-id[@by='#foo%{irc_server_one}'][@id]"),
+ ),
+
+ # Send a message from a resource that is not joined
+ partial(send_stanza, "<message from='{jid_one}/{resource_two}' to='#foo%{irc_server_one}' type='groupchat'><body>coucou</body></message>"),
+ partial(expect_stanza, ("/message[@type='error']/error[@type='modify']/stanza:text[text()='You are not a participant in this room.']",
+ "/message/error/stanza:not-acceptable"
+ ))
+
+ ]),
Scenario("encoded_channel_join",
[
handshake_sequence(),