Made removeHostmask remove all the matching hostmasks.

This commit is contained in:
Jeremy Fincher 2003-11-19 15:35:01 +00:00
parent 0b90d80fee
commit 9a7de79467
2 changed files with 9 additions and 1 deletions

View File

@ -267,7 +267,7 @@ class IrcUser(object):
def removeHostmask(self, hostmask):
"""Removes a hostmask from the user's hostmasks."""
self.hostmasks.remove(hostmask)
self.hostmasks = [s for s in self.hostmasks if s != hostmask]
def setAuth(self, hostmask):
"""Sets a user's authenticated hostmask. This times out in 1 hour."""

View File

@ -203,6 +203,14 @@ class IrcUserTestCase(unittest.TestCase):
self.assertRaises(KeyError, u.checkCapability, 'foo')
self.assertRaises(KeyError, u.checkCapability, '-bar')
def testRemoveHostmask(self):
u = ircdb.IrcUser()
u.addHostmask('foo!bar@baz')
self.failUnless(u.checkHostmask('foo!bar@baz'))
u.addHostmask('foo!bar@baz')
u.removeHostmask('foo!bar@baz')
self.failIf(u.checkHostmask('foo!bar@baz'))
def testOwner(self):
u = ircdb.IrcUser()
u.addCapability('owner')