mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-09 02:54:13 +01:00
Fixed the case problem in User.list.
This commit is contained in:
parent
9788815bdd
commit
3179a8d8bc
@ -37,6 +37,7 @@ __revision__ = "$Id$"
|
|||||||
|
|
||||||
import fix
|
import fix
|
||||||
|
|
||||||
|
import re
|
||||||
import getopt
|
import getopt
|
||||||
import string
|
import string
|
||||||
import fnmatch
|
import fnmatch
|
||||||
@ -66,8 +67,9 @@ class User(callbacks.Privmsg):
|
|||||||
if glob:
|
if glob:
|
||||||
if '*' not in glob and '?' not in glob:
|
if '*' not in glob and '?' not in glob:
|
||||||
glob = '*%s*' % glob
|
glob = '*%s*' % glob
|
||||||
|
r = re.compile(fnmatch.translate(glob), re.I)
|
||||||
def p(s):
|
def p(s):
|
||||||
return fnmatch.fnmatch(s, glob)
|
return r.match(s) is not None
|
||||||
else:
|
else:
|
||||||
def p(s):
|
def p(s):
|
||||||
return True
|
return True
|
||||||
|
@ -59,6 +59,13 @@ class UserTestCase(PluginTestCase, PluginDocumentation):
|
|||||||
self.assertResponse('user list', 'foo')
|
self.assertResponse('user list', 'foo')
|
||||||
self.assertNotError('unregister foo bar')
|
self.assertNotError('unregister foo bar')
|
||||||
self.assertRegexp('user list', 'no registered users')
|
self.assertRegexp('user list', 'no registered users')
|
||||||
|
self.assertRegexp('user list asdlfkjasldkj', 'no matching registered')
|
||||||
|
|
||||||
|
def testListHandlesCaps(self):
|
||||||
|
self.prefix = self.prefix1
|
||||||
|
self.assertNotError('register Foo bar')
|
||||||
|
self.assertResponse('user list', 'Foo')
|
||||||
|
self.assertResponse('user list f*', 'Foo')
|
||||||
|
|
||||||
def testChangeUsername(self):
|
def testChangeUsername(self):
|
||||||
self.prefix = self.prefix1
|
self.prefix = self.prefix1
|
||||||
|
Loading…
Reference in New Issue
Block a user