From 7e5cd2f13036b61781e1799565597ab798b50a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 23 Jun 2017 14:49:10 +0200 Subject: Add e2e tests for the (un)subscribe thing --- tests/end_to_end/__main__.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'tests') 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 = '' % ( '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, "") - ]) + ]), + Scenario("basic_subscribe_unsubscribe", + [ + handshake_sequence(), + + # Mutual subscription exchange + partial(send_stanza, ""), + 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, ""), + + + # Unsubscribe + partial(send_stanza, ""), + partial(expect_stanza, "/presence[@type='unavailable']"), + partial(expect_stanza, "/presence[@type='unsubscribe']"), + partial(send_stanza, ""), + ]) ) failures = 0 -- cgit v1.2.3