summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2020-03-11 00:08:18 +0100
committerlouiz’ <louiz@louiz.org>2020-03-11 00:13:46 +0100
commite967088986f0d32eec662e2ab3749e4ba8e07a21 (patch)
treed0024347d28fed1afafc330ead744ca1bb9043db /tests
parent49a3931784d4b58e1f618f5424701ae6de79833b (diff)
downloadbiboumi-e967088986f0d32eec662e2ab3749e4ba8e07a21.tar.gz
biboumi-e967088986f0d32eec662e2ab3749e4ba8e07a21.tar.bz2
biboumi-e967088986f0d32eec662e2ab3749e4ba8e07a21.tar.xz
biboumi-e967088986f0d32eec662e2ab3749e4ba8e07a21.zip
Make sure we keep the stable-id and origin-id nodes when required
See https://xmpp.org/extensions/xep-0359.html
Diffstat (limited to 'tests')
-rw-r--r--tests/end_to_end/scenarios/stable_id.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/end_to_end/scenarios/stable_id.py b/tests/end_to_end/scenarios/stable_id.py
new file mode 100644
index 0000000..90b5866
--- /dev/null
+++ b/tests/end_to_end/scenarios/stable_id.py
@@ -0,0 +1,26 @@
+from scenarios import *
+
+import scenarios.simple_channel_join
+
+# see https://xmpp.org/extensions/xep-0359.html
+
+scenario = (
+ scenarios.simple_channel_join.scenario,
+
+ send_stanza("""<message id='first_id' from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}' type='groupchat'>
+ <origin-id xmlns='urn:xmpp:sid:0' id='client-origin-id'/>
+ <stanza-id xmlns='urn:xmpp:sid:0' id='client-stanza-id'/>
+ <body>coucou</body></message>"""),
+
+ # Entities, which are routing stanzas, SHOULD NOT strip any elements
+ # qualified by the 'urn:xmpp:sid:0' namespace from message stanzas
+ # unless the preceding rule applied to those elements.
+ expect_stanza("/message/stable_id:origin-id[@id='client-origin-id']",
+ # Stanza ID generating entities, which encounter a <stanza-id/>
+ # element where the 'by' attribute matches the 'by' attribute they
+ # would otherwise set, MUST delete that element even if they are not
+ # adding their own stanza ID.
+ "/message/stable_id:stanza-id[@id][@by='#foo%{irc_server_one}']",
+ "!/message/stable_id:stanza-id[@id='client-stanza-id']",
+ ),
+)