mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-03-01 03:50:41 +01:00
Services: Update to the latest version of the draft/account-registration spec.
This commit is contained in:
parent
67a39a3adb
commit
2293d1c129
@ -635,9 +635,9 @@ class Services(callbacks.Plugin):
|
|||||||
Raise=True
|
Raise=True
|
||||||
)
|
)
|
||||||
|
|
||||||
if "draft/register" not in otherIrc.state.capabilities_ls:
|
if "draft/account-registration" not in otherIrc.state.capabilities_ls:
|
||||||
irc.error(
|
irc.error(
|
||||||
_("This network does not support draft/register."),
|
_("This network does not support draft/account-registration."),
|
||||||
Raise=True
|
Raise=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -665,7 +665,7 @@ class Services(callbacks.Plugin):
|
|||||||
# https://gist.github.com/edk0/bf3b50fc219fd1bed1aa15d98bfb6495
|
# https://gist.github.com/edk0/bf3b50fc219fd1bed1aa15d98bfb6495
|
||||||
self._checkCanRegister(irc, otherIrc)
|
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:
|
if "email-required" in cap_values and email is None:
|
||||||
irc.error(
|
irc.error(
|
||||||
_("This network requires an email address to register."),
|
_("This network requires an email address to register."),
|
||||||
@ -677,7 +677,7 @@ class Services(callbacks.Plugin):
|
|||||||
otherIrc.queueMsg(ircmsgs.IrcMsg(
|
otherIrc.queueMsg(ircmsgs.IrcMsg(
|
||||||
server_tags={"label": label},
|
server_tags={"label": label},
|
||||||
command="REGISTER",
|
command="REGISTER",
|
||||||
args=[email or "*", password],
|
args=["*", email or "*", password],
|
||||||
))
|
))
|
||||||
register = wrap(register, ["owner", "private", "networkIrc", "something", optional("email")])
|
register = wrap(register, ["owner", "private", "networkIrc", "something", optional("email")])
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ class ExperimentalServicesTestCase(PluginTestCase):
|
|||||||
super().setUp()
|
super().setUp()
|
||||||
conf.supybot.protocols.irc.experimentalExtensions.setValue(True)
|
conf.supybot.protocols.irc.experimentalExtensions.setValue(True)
|
||||||
self._initialCaps = self.irc.state.capabilities_ls.copy()
|
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
|
self.irc.state.capabilities_ls["labeled-response"] = None
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
@ -208,17 +208,17 @@ class ExperimentalServicesTestCase(PluginTestCase):
|
|||||||
"register p4ssw0rd",
|
"register p4ssw0rd",
|
||||||
"error: This network does not support labeled-response.")
|
"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(
|
self.assertRegexp(
|
||||||
"register p4ssw0rd",
|
"register p4ssw0rd",
|
||||||
"error: This network does not support draft/register.")
|
"error: This network does not support draft/account-registration.")
|
||||||
finally:
|
finally:
|
||||||
self.irc.state.capabilities_ls = old_caps
|
self.irc.state.capabilities_ls = old_caps
|
||||||
|
|
||||||
def testRegisterRequireEmail(self):
|
def testRegisterRequireEmail(self):
|
||||||
old_caps = self.irc.state.capabilities_ls.copy()
|
old_caps = self.irc.state.capabilities_ls.copy()
|
||||||
try:
|
try:
|
||||||
self.irc.state.capabilities_ls["draft/register"] = "email-required"
|
self.irc.state.capabilities_ls["draft/account-registration"] = "email-required"
|
||||||
self.assertRegexp(
|
self.assertRegexp(
|
||||||
"register p4ssw0rd",
|
"register p4ssw0rd",
|
||||||
"error: This network requires an email address to register.")
|
"error: This network requires an email address to register.")
|
||||||
@ -228,7 +228,7 @@ class ExperimentalServicesTestCase(PluginTestCase):
|
|||||||
def testRegisterSuccess(self):
|
def testRegisterSuccess(self):
|
||||||
m = self.getMsg("register p4ssw0rd")
|
m = self.getMsg("register p4ssw0rd")
|
||||||
label = m.server_tags.pop("label")
|
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(
|
self.irc.feedMsg(IrcMsg(
|
||||||
server_tags={"label": label},
|
server_tags={"label": label},
|
||||||
command="REGISTER",
|
command="REGISTER",
|
||||||
@ -242,7 +242,7 @@ class ExperimentalServicesTestCase(PluginTestCase):
|
|||||||
# oragono replies with a batch
|
# oragono replies with a batch
|
||||||
m = self.getMsg("register p4ssw0rd")
|
m = self.getMsg("register p4ssw0rd")
|
||||||
label = m.server_tags.pop("label")
|
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"
|
batch_name = "Services_testRegisterSuccessBatch"
|
||||||
self.irc.feedMsg(IrcMsg(
|
self.irc.feedMsg(IrcMsg(
|
||||||
@ -273,7 +273,7 @@ class ExperimentalServicesTestCase(PluginTestCase):
|
|||||||
m = self.getMsg("register p4ssw0rd foo@example.org")
|
m = self.getMsg("register p4ssw0rd foo@example.org")
|
||||||
label = m.server_tags.pop("label")
|
label = m.server_tags.pop("label")
|
||||||
self.assertEqual(m, IrcMsg(
|
self.assertEqual(m, IrcMsg(
|
||||||
command="REGISTER", args=["foo@example.org", "p4ssw0rd"]))
|
command="REGISTER", args=["*", "foo@example.org", "p4ssw0rd"]))
|
||||||
self.irc.feedMsg(IrcMsg(
|
self.irc.feedMsg(IrcMsg(
|
||||||
server_tags={"label": label},
|
server_tags={"label": label},
|
||||||
command="REGISTER",
|
command="REGISTER",
|
||||||
@ -286,7 +286,7 @@ class ExperimentalServicesTestCase(PluginTestCase):
|
|||||||
def testRegisterVerify(self):
|
def testRegisterVerify(self):
|
||||||
m = self.getMsg("register p4ssw0rd")
|
m = self.getMsg("register p4ssw0rd")
|
||||||
label = m.server_tags.pop("label")
|
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(
|
self.irc.feedMsg(IrcMsg(
|
||||||
server_tags={"label": label},
|
server_tags={"label": label},
|
||||||
command="REGISTER",
|
command="REGISTER",
|
||||||
@ -313,7 +313,7 @@ class ExperimentalServicesTestCase(PluginTestCase):
|
|||||||
def testRegisterVerifyBatch(self):
|
def testRegisterVerifyBatch(self):
|
||||||
m = self.getMsg("register p4ssw0rd")
|
m = self.getMsg("register p4ssw0rd")
|
||||||
label = m.server_tags.pop("label")
|
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(
|
self.irc.feedMsg(IrcMsg(
|
||||||
server_tags={"label": label},
|
server_tags={"label": label},
|
||||||
command="REGISTER",
|
command="REGISTER",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user