aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-06-20 21:08:12 +0200
committerKim Alvefur <zash@zash.se>2019-06-20 21:08:12 +0200
commit85748bb15e4bcf901248879f728f89e7e1513f21 (patch)
tree702ed01cb04f34d986a46e83bb714489cec781cf
parent3b5c4ceac3e7c1482305eda4ea0b615151875f1d (diff)
downloadprosody-85748bb15e4bcf901248879f728f89e7e1513f21.tar.gz
prosody-85748bb15e4bcf901248879f728f89e7e1513f21.zip
mod_blocklist: Add test case capturing current behavior
-rw-r--r--spec/scansion/blocking.scs162
1 files changed, 162 insertions, 0 deletions
diff --git a/spec/scansion/blocking.scs b/spec/scansion/blocking.scs
new file mode 100644
index 00000000..5f4c8cba
--- /dev/null
+++ b/spec/scansion/blocking.scs
@@ -0,0 +1,162 @@
+# XEP-0191: Blocking Command
+
+[Client] Romeo
+ jid: blocker@localhost
+ password: password
+
+[Client] Juliet
+ jid: blockee@localhost
+ password: password
+
+-----
+
+# The parties connect
+Romeo connects
+
+Romeo sends:
+ <presence/>
+
+Romeo receives:
+ <presence from="${Romeo's full JID}">
+ <x xmlns="vcard-temp:x:update"/>
+ </presence>
+
+Juliet connects
+
+Juliet sends:
+ <presence/>
+
+Juliet receives:
+ <presence from="${Juliet's full JID}">
+ <x xmlns="vcard-temp:x:update"/>
+ </presence>
+
+# They add each other
+Romeo sends:
+ <presence type="subscribe" to="${Juliet's JID}"/>
+
+Romeo receives:
+ <presence from="${Juliet's JID}" to="${Romeo's JID}" type="unavailable"/>
+
+Juliet receives:
+ <presence type="subscribe" to="${Juliet's JID}" from="${Romeo's JID}"/>
+
+Juliet sends:
+ <presence type="subscribed" to="${Romeo's JID}"/>
+
+Romeo receives:
+ <presence from="${Juliet's full JID}" to="${Romeo's JID}">
+ <delay xmlns="urn:xmpp:delay" stamp="{scansion:any}" from="localhost"/>
+ <x xmlns="vcard-temp:x:update"/>
+ </presence>
+
+Juliet sends:
+ <presence type="subscribe" to="${Romeo's JID}"/>
+
+Juliet receives:
+ <presence from="${Romeo's JID}" to="${Juliet's JID}" type="unavailable"/>
+
+Romeo receives:
+ <presence type="subscribe" to="${Romeo's JID}" from="${Juliet's JID}"/>
+
+Romeo sends:
+ <presence type="subscribed" to="${Juliet's JID}"/>
+
+Juliet receives:
+ <presence from="${Romeo's full JID}" to="${Juliet's JID}">
+ <delay xmlns="urn:xmpp:delay" stamp="{scansion:any}" from="localhost"/>
+ <x xmlns="vcard-temp:x:update"/>
+ </presence>
+
+Romeo receives:
+ <presence from="${Juliet's full JID}" to="${Romeo's JID}">
+ <delay xmlns="urn:xmpp:delay" stamp="{scansion:any}" from="localhost"/>
+ <x xmlns="vcard-temp:x:update"/>
+ </presence>
+
+# They can now talk
+Juliet sends:
+ <message type="chat" to="${Romeo's JID}">
+ <body>ohai</body>
+ </message>
+
+Romeo receives:
+ <message type="chat" to="${Romeo's JID}" from="${Juliet's full JID}">
+ <body>ohai</body>
+ </message>
+
+# And now to the blockining
+
+Romeo sends:
+ <iq type="set" id="lx2">
+ <block xmlns="urn:xmpp:blocking">
+ <item jid="${Juliet's JID}"/>
+ </block>
+ </iq>
+
+Romeo receives:
+ <iq type="result" id="lx2"/>
+
+Juliet receives:
+ <presence type="unavailable" to="${Juliet's JID}" from="${Romeo's full JID}"/>
+
+# Can"t talk anymore
+Romeo sends:
+ <message type="chat" to="${Juliet's JID}">
+ <body>hello?</body>
+ </message>
+
+Romeo receives:
+ <message type="error" from="${Juliet's JID}">
+ <error type="cancel">
+ <not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
+ <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">You have blocked this JID</text>
+ <blocked xmlns="urn:xmpp:blocking:errors"/>
+ </error>
+ </message>
+
+Juliet sends:
+ <message type="chat" to="${Romeo's JID}"/>
+
+Juliet receives:
+ <message type="error" from="${Romeo's JID}">
+ <error type="cancel">
+ <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
+ </error>
+ </message>
+
+Romeo sends:
+ <iq type="set" id="lx3">
+ <unblock xmlns="urn:xmpp:blocking">
+ <item jid="${Juliet's JID}"/>
+ </unblock>
+ </iq>
+
+Romeo receives:
+ <iq type="result" id="lx3"/>
+
+# Can talk again
+Romeo sends:
+ <message type="chat" to="${Juliet's JID}">
+ <body>hello!</body>
+ </message>
+
+Juliet receives:
+ <message type="chat" to="${Juliet's JID}" from="${Romeo's full JID}">
+ <body>hello!</body>
+ </message>
+
+# Bye
+Juliet disconnects
+
+Juliet sends:
+ <presence type="unavailable"/>
+
+Romeo receives:
+ <presence from="${Juliet's full JID}" to="${Romeo's JID}" type="unavailable"/>
+
+Romeo disconnects
+
+Romeo sends:
+ <presence type="unavailable"/>
+