diff --git a/src/ircdb.py b/src/ircdb.py index 6494f3b3f..ecc395885 100644 --- a/src/ircdb.py +++ b/src/ircdb.py @@ -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.""" diff --git a/test/test_ircdb.py b/test/test_ircdb.py index d6540fc92..0875054ca 100644 --- a/test/test_ircdb.py +++ b/test/test_ircdb.py @@ -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')