summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-06-23 14:49:10 +0200
committerlouiz’ <louiz@louiz.org>2017-07-16 00:16:43 +0200
commit7e5cd2f13036b61781e1799565597ab798b50a74 (patch)
tree2d1313451d7966eee36d69704863fa0350066d46
parent71f125db1a11f4b728beee1d1aa2ef7d37f38000 (diff)
downloadbiboumi-7e5cd2f13036b61781e1799565597ab798b50a74.tar.gz
biboumi-7e5cd2f13036b61781e1799565597ab798b50a74.tar.bz2
biboumi-7e5cd2f13036b61781e1799565597ab798b50a74.tar.xz
biboumi-7e5cd2f13036b61781e1799565597ab798b50a74.zip
Add e2e tests for the (un)subscribe thing
-rw-r--r--tests/end_to_end/__main__.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py
index 7259999..a718a63 100644
--- a/tests/end_to_end/__main__.py
+++ b/tests/end_to_end/__main__.py
@@ -49,6 +49,8 @@ class XMPPComponent(slixmpp.BaseXMPP):
def __init__(self, scenario, biboumi):
super().__init__(jid="biboumi.localhost", default_ns="jabber:component:accept")
self.is_component = True
+ self.auto_authorize = None # Do not accept or reject subscribe requests automatically
+ self.auto_subscribe = False
self.stream_header = '<stream:stream %s %s from="%s" id="%s">' % (
'xmlns="jabber:component:accept"',
'xmlns:stream="%s"' % self.stream_ns,
@@ -2671,7 +2673,28 @@ if __name__ == '__main__':
partial(expect_stanza, "/message[@to='{jid_two}/{resource_two}'][@type='chat']/body[text()='irc.localhost: {nick_one}: Nickname is already in use.']"),
partial(expect_stanza, "/presence[@type='error']/error[@type='cancel'][@code='409']/stanza:conflict"),
partial(send_stanza, "<presence from='{jid_two}/{resource_two}' to='#foo%{irc_server_one}/{nick_one}' type='unavailable' />")
- ])
+ ]),
+ Scenario("basic_subscribe_unsubscribe",
+ [
+ handshake_sequence(),
+
+ # Mutual subscription exchange
+ partial(send_stanza, "<presence from='{jid_one}' to='{biboumi_host}' type='subscribe' id='subid1' />"),
+ partial(expect_stanza, "/presence[@type='subscribed'][@id='subid1']"),
+
+ # Get the current presence of the biboumi gateway
+ partial(expect_stanza, "/presence"),
+
+ partial(expect_stanza, "/presence[@type='subscribe']"),
+ partial(send_stanza, "<presence from='{jid_one}' to='{biboumi_host}' type='subscribed' />"),
+
+
+ # Unsubscribe
+ partial(send_stanza, "<presence from='{jid_one}' to='{biboumi_host}' type='unsubscribe' id='unsubid1' />"),
+ partial(expect_stanza, "/presence[@type='unavailable']"),
+ partial(expect_stanza, "/presence[@type='unsubscribe']"),
+ partial(send_stanza, "<presence from='{jid_one}' to='{biboumi_host}' type='unavailable' />"),
+ ])
)
failures = 0