Fixed the case problem in User.list.

This commit is contained in:
Jeremy Fincher 2003-12-01 21:27:26 +00:00
parent 9788815bdd
commit 3179a8d8bc
2 changed files with 10 additions and 1 deletions

View File

@ -37,6 +37,7 @@ __revision__ = "$Id$"
import fix
import re
import getopt
import string
import fnmatch
@ -66,8 +67,9 @@ class User(callbacks.Privmsg):
if glob:
if '*' not in glob and '?' not in glob:
glob = '*%s*' % glob
r = re.compile(fnmatch.translate(glob), re.I)
def p(s):
return fnmatch.fnmatch(s, glob)
return r.match(s) is not None
else:
def p(s):
return True

View File

@ -59,6 +59,13 @@ class UserTestCase(PluginTestCase, PluginDocumentation):
self.assertResponse('user list', 'foo')
self.assertNotError('unregister foo bar')
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):
self.prefix = self.prefix1