From d452c2ff1897d5f5c519d6a821598864d8207933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Mon, 25 Apr 2016 10:28:53 +0200 Subject: Add e2e tests for the ad-hoc listing on the server jid --- tests/end_to_end/__main__.py | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py index 3b2e9ee..4f8e35b 100644 --- a/tests/end_to_end/__main__.py +++ b/tests/end_to_end/__main__.py @@ -108,7 +108,8 @@ def check_xpath(xpaths, stanza): for xpath in xpaths: tree = lxml.etree.parse(io.StringIO(str(stanza))) matched = tree.xpath(xpath, namespaces={'re': 'http://exslt.org/regular-expressions', - 'muc_user': 'http://jabber.org/protocol/muc#user'}) + 'muc_user': 'http://jabber.org/protocol/muc#user', + 'disco_items': 'http://jabber.org/protocol/disco#items'}) if not matched: raise StanzaError("Received stanza ā€œ%sā€ did not match expected xpath ā€œ%sā€" % (stanza, xpath)) @@ -260,7 +261,8 @@ confs = { """hostname=biboumi.localhost password=coucou db_name=biboumi.sqlite -port=8811""", +port=8811 +admin=admin@example.com""", 'fixed_server': """hostname=biboumi.localhost @@ -268,6 +270,7 @@ password=coucou db_name=biboumi.sqlite port=8811 fixed_irc_server=irc.localhost +admin=admin@example.com """} common_replacements = { @@ -278,6 +281,7 @@ common_replacements = { 'nick_one': 'Nick', 'jid_one': 'first@example.com', 'jid_two': 'second@example.com', + 'jid_admin': 'admin@example.com', 'nick_two': 'Bobby', } @@ -482,6 +486,34 @@ if __name__ == '__main__': partial(expect_stanza, "/message[@from='#zgeg@{biboumi_host}'][@type='groupchat']/subject[not(text())]"), ], conf='fixed_server' ), + Scenario("list_adhoc", + [ + handshake_sequence(), + partial(send_stanza, ""), + partial(expect_stanza, ("/iq[@type='result']/disco_items:query[@node='http://jabber.org/protocol/commands']", + "/iq/disco_items:query/disco_items:item[3]")), + ]), + Scenario("list_admin_adhoc", + [ + handshake_sequence(), + partial(send_stanza, ""), + partial(expect_stanza, ("/iq[@type='result']/disco_items:query[@node='http://jabber.org/protocol/commands']", + "/iq/disco_items:query/disco_items:item[5]")), + ]), + Scenario("list_adhoc_fixed_server", + [ + handshake_sequence(), + partial(send_stanza, ""), + partial(expect_stanza, ("/iq[@type='result']/disco_items:query[@node='http://jabber.org/protocol/commands']", + "/iq/disco_items:query/disco_items:item[3]")), + ], conf='fixed_server'), + Scenario("list_admin_adhoc_fixed_server", + [ + handshake_sequence(), + partial(send_stanza, ""), + partial(expect_stanza, ("/iq[@type='result']/disco_items:query[@node='http://jabber.org/protocol/commands']", + "/iq/disco_items:query/disco_items:item[5]")), + ], conf='fixed_server'), ) failures = 0 -- cgit v1.2.3