mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Seen: Fix any to work with wildcards when protocols.irc.strictRfc is true
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
parent
cfe71c4f55
commit
4d677dbcf5
@ -1,6 +1,6 @@
|
|||||||
###
|
###
|
||||||
# Copyright (c) 2002-2004, Jeremiah Fincher
|
# Copyright (c) 2002-2004, Jeremiah Fincher
|
||||||
# Copyright (c) 2010-2011, James McCoy
|
# Copyright (c) 2010-2011, 2013, James McCoy
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
@ -243,7 +243,7 @@ class Seen(callbacks.Plugin):
|
|||||||
else:
|
else:
|
||||||
self._last(irc, channel, any=True)
|
self._last(irc, channel, any=True)
|
||||||
any = wrap(any, ['channel', getopts({'user': 'otherUser'}),
|
any = wrap(any, ['channel', getopts({'user': 'otherUser'}),
|
||||||
additional('nick')])
|
additional('something')])
|
||||||
|
|
||||||
def _last(self, irc, channel, any=False):
|
def _last(self, irc, channel, any=False):
|
||||||
if any:
|
if any:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
###
|
###
|
||||||
# Copyright (c) 2002-2004, Jeremiah Fincher
|
# Copyright (c) 2002-2004, Jeremiah Fincher
|
||||||
|
# Copyright (c) 2013, James McCoy
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
@ -55,6 +56,16 @@ class ChannelDBTestCase(ChannelPluginTestCase):
|
|||||||
prefix=self.prefix))
|
prefix=self.prefix))
|
||||||
self.assertRegexp('seen any %s' % self.nick,
|
self.assertRegexp('seen any %s' % self.nick,
|
||||||
'^%s was last seen' % self.nick)
|
'^%s was last seen' % self.nick)
|
||||||
|
orig = conf.supybot.protocols.irc.strictRfc()
|
||||||
|
try:
|
||||||
|
for state in (True, False):
|
||||||
|
conf.supybot.protocols.irc.strictRfc.setValue(state)
|
||||||
|
for wildcard in self.wildcardTest:
|
||||||
|
self.assertRegexp('seen any %s' % wildcard,
|
||||||
|
'^%s was last seen' % self.nick)
|
||||||
|
self.assertRegexp('seen any bar*', '^I haven\'t seen anyone matching')
|
||||||
|
finally:
|
||||||
|
conf.supybot.protocols.irc.strictRfc.setValue(orig)
|
||||||
|
|
||||||
def testSeen(self):
|
def testSeen(self):
|
||||||
self.assertNotError('seen last')
|
self.assertNotError('seen last')
|
||||||
@ -64,10 +75,16 @@ class ChannelDBTestCase(ChannelPluginTestCase):
|
|||||||
self.failUnless(self.nick.upper() in m.args[1])
|
self.failUnless(self.nick.upper() in m.args[1])
|
||||||
self.assertRegexp('seen user %s' % self.nick,
|
self.assertRegexp('seen user %s' % self.nick,
|
||||||
'^%s was last seen' % self.nick)
|
'^%s was last seen' % self.nick)
|
||||||
for wildcard in self.wildcardTest:
|
orig = conf.supybot.protocols.irc.strictRfc()
|
||||||
self.assertRegexp('seen %s' % wildcard,
|
try:
|
||||||
'^%s was last seen' % self.nick)
|
for state in (True, False):
|
||||||
self.assertRegexp('seen bar*', '^I haven\'t seen anyone matching')
|
conf.supybot.protocols.irc.strictRfc.setValue(state)
|
||||||
|
for wildcard in self.wildcardTest:
|
||||||
|
self.assertRegexp('seen %s' % wildcard,
|
||||||
|
'^%s was last seen' % self.nick)
|
||||||
|
self.assertRegexp('seen bar*', '^I haven\'t seen anyone matching')
|
||||||
|
finally:
|
||||||
|
conf.supybot.protocols.irc.strictRfc.setValue(orig)
|
||||||
|
|
||||||
def testSeenNoUser(self):
|
def testSeenNoUser(self):
|
||||||
self.assertNotRegexp('seen user alsdkfjalsdfkj', 'KeyError')
|
self.assertNotRegexp('seen user alsdkfjalsdfkj', 'KeyError')
|
||||||
|
Loading…
Reference in New Issue
Block a user