Don't hardcode ver, update node name, and add tests

This commit is contained in:
Luca Matei Pintilie
2026-08-19 21:30:27 +02:00
parent 567b139e1c
commit df83dd19ae
10 changed files with 223 additions and 13 deletions
+23
View File
@@ -0,0 +1,23 @@
from scenarios import *
scenario = (
send_stanza("<presence id='get1' from='{jid_one}/{resource_one}' to='{biboumi_host}' xmlns='jabber:component:accept'></presence>"),
expect_stanza("/presence/caps:c[@hash='sha-1'][@node][@ver]",
after = (
save_value("ver", extract_attribute("/presence/caps:c[@hash='sha-1'][@node][@ver]", "ver")),
save_value("node", extract_attribute("/presence/caps:c[@hash='sha-1'][@node][@ver]", "node")),
)
),
# Assert node and ver are consistent
send_stanza("<presence id='get2' from='{jid_one}/{resource_one}' to='{biboumi_host}' xmlns='jabber:component:accept'></presence>"),
expect_stanza("/presence/caps:c[@hash='sha-1'][@node='{node}'][@ver='{ver}']"),
# If we ask for this node then we should get it back
send_stanza("<iq type='get' id='get3' from='{jid_one}/{resource_one}' to='{biboumi_host}'><query xmlns='http://jabber.org/protocol/disco#info' node='{node}#{ver}' /></iq>"),
expect_stanza("/iq/disco_info:query[@node='{node}#{ver}']"),
# But if we ask for invalid values then we don't
send_stanza("<iq type='get' id='get4' from='{jid_one}/{resource_one}' to='{biboumi_host}' xmlns='jabber:component:accept'><query xmlns='http://jabber.org/protocol/disco#info' node='{node}#asdf' /></iq>"),
expect_stanza("!/iq/disco_info:query[@node='{node}#{ver}']"),
send_stanza("<iq type='get' id='get5' from='{jid_one}/{resource_one}' to='{biboumi_host}' xmlns='jabber:component:accept'><query xmlns='http://jabber.org/protocol/disco#info' node='asdf' /></iq>"),
expect_stanza("!/iq/disco_info:query[@node='{node}#{ver}']"),
)
@@ -7,5 +7,8 @@ scenario = (
"/iq/disco_info:query/disco_info:feature[@var='http://jabber.org/protocol/commands']",
"/iq/disco_info:query/disco_info:feature[@var='urn:xmpp:ping']",
"/iq/disco_info:query/disco_info:feature[@var='urn:xmpp:mam:2']",
"/iq/disco_info:query/disco_info:feature[@var='jabber:iq:version']"),
"/iq/disco_info:query/disco_info:feature[@var='jabber:iq:version']",
"/iq/disco_info:query/disco_info:identity[@category='conference'][@type='irc']",
"/iq/disco_info:query/disco_info:identity[@category='gateway'][@type='irc']",
),
)