Services: Update to the latest version of the draft/account-registration spec.

This commit is contained in:
Valentin Lorentz 2021-06-15 20:34:50 +02:00
parent 67a39a3adb
commit 2293d1c129
2 changed files with 13 additions and 13 deletions

View File

@ -635,9 +635,9 @@ class Services(callbacks.Plugin):
Raise=True
)
if "draft/register" not in otherIrc.state.capabilities_ls:
if "draft/account-registration" not in otherIrc.state.capabilities_ls:
irc.error(
_("This network does not support draft/register."),
_("This network does not support draft/account-registration."),
Raise=True
)
@ -665,7 +665,7 @@ class Services(callbacks.Plugin):
# https://gist.github.com/edk0/bf3b50fc219fd1bed1aa15d98bfb6495
self._checkCanRegister(irc, otherIrc)
cap_values = (otherIrc.state.capabilities_ls["draft/register"] or "").split(",")
cap_values = (otherIrc.state.capabilities_ls["draft/account-registration"] or "").split(",")
if "email-required" in cap_values and email is None:
irc.error(
_("This network requires an email address to register."),
@ -677,7 +677,7 @@ class Services(callbacks.Plugin):
otherIrc.queueMsg(ircmsgs.IrcMsg(
server_tags={"label": label},
command="REGISTER",
args=[email or "*", password],
args=["*", email or "*", password],
))
register = wrap(register, ["owner", "private", "networkIrc", "something", optional("email")])

View File

@ -192,7 +192,7 @@ class ExperimentalServicesTestCase(PluginTestCase):
super().setUp()
conf.supybot.protocols.irc.experimentalExtensions.setValue(True)
self._initialCaps = self.irc.state.capabilities_ls.copy()
self.irc.state.capabilities_ls["draft/register"] = None
self.irc.state.capabilities_ls["draft/account-registration"] = None
self.irc.state.capabilities_ls["labeled-response"] = None
def tearDown(self):
@ -208,17 +208,17 @@ class ExperimentalServicesTestCase(PluginTestCase):
"register p4ssw0rd",
"error: This network does not support labeled-response.")
del self.irc.state.capabilities_ls["draft/register"]
del self.irc.state.capabilities_ls["draft/account-registration"]
self.assertRegexp(
"register p4ssw0rd",
"error: This network does not support draft/register.")
"error: This network does not support draft/account-registration.")
finally:
self.irc.state.capabilities_ls = old_caps
def testRegisterRequireEmail(self):
old_caps = self.irc.state.capabilities_ls.copy()
try:
self.irc.state.capabilities_ls["draft/register"] = "email-required"
self.irc.state.capabilities_ls["draft/account-registration"] = "email-required"
self.assertRegexp(
"register p4ssw0rd",
"error: This network requires an email address to register.")
@ -228,7 +228,7 @@ class ExperimentalServicesTestCase(PluginTestCase):
def testRegisterSuccess(self):
m = self.getMsg("register p4ssw0rd")
label = m.server_tags.pop("label")
self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "p4ssw0rd"]))
self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "*", "p4ssw0rd"]))
self.irc.feedMsg(IrcMsg(
server_tags={"label": label},
command="REGISTER",
@ -242,7 +242,7 @@ class ExperimentalServicesTestCase(PluginTestCase):
# oragono replies with a batch
m = self.getMsg("register p4ssw0rd")
label = m.server_tags.pop("label")
self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "p4ssw0rd"]))
self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "*", "p4ssw0rd"]))
batch_name = "Services_testRegisterSuccessBatch"
self.irc.feedMsg(IrcMsg(
@ -273,7 +273,7 @@ class ExperimentalServicesTestCase(PluginTestCase):
m = self.getMsg("register p4ssw0rd foo@example.org")
label = m.server_tags.pop("label")
self.assertEqual(m, IrcMsg(
command="REGISTER", args=["foo@example.org", "p4ssw0rd"]))
command="REGISTER", args=["*", "foo@example.org", "p4ssw0rd"]))
self.irc.feedMsg(IrcMsg(
server_tags={"label": label},
command="REGISTER",
@ -286,7 +286,7 @@ class ExperimentalServicesTestCase(PluginTestCase):
def testRegisterVerify(self):
m = self.getMsg("register p4ssw0rd")
label = m.server_tags.pop("label")
self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "p4ssw0rd"]))
self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "*", "p4ssw0rd"]))
self.irc.feedMsg(IrcMsg(
server_tags={"label": label},
command="REGISTER",
@ -313,7 +313,7 @@ class ExperimentalServicesTestCase(PluginTestCase):
def testRegisterVerifyBatch(self):
m = self.getMsg("register p4ssw0rd")
label = m.server_tags.pop("label")
self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "p4ssw0rd"]))
self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "*", "p4ssw0rd"]))
self.irc.feedMsg(IrcMsg(
server_tags={"label": label},
command="REGISTER",