Files
biboumi/tests/end_to_end/scenarios/nick_change_spaces.py
T
Stephen Paul Weber d8bc3d17bb IRC nicks cannot contain spaces
Rather than trying and hoping the server gives a proper failure, just
fail early and avoid the whole mess. Some servers will instead send
messages to the user, etc, which is not very helpful.
2026-09-23 21:58:20 -05:00

14 lines
895 B
Python

from scenarios import *
scenario = (
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
sequences.connection(),
expect_stanza("/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]"),
# Attempt to change nick to a nickname containing a space
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/Nick With Space' />"),
expect_stanza("/message[@from='{irc_server_one}'][@to='{jid_one}/{resource_one}']/body[text()='irc.localhost: Erroneous nickname: Nick With Space']"),
)