mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Made sure IrcUser.removeCapability raises KeyError on capabilities the user doesn't have.
This commit is contained in:
parent
b1654bd4bc
commit
b50a01db7d
@ -194,8 +194,7 @@ class IrcUser(object):
|
||||
self.capabilities.add(capability)
|
||||
|
||||
def removeCapability(self, capability):
|
||||
if capability in self.capabilities:
|
||||
self.capabilities.remove(capability)
|
||||
self.capabilities.remove(capability)
|
||||
|
||||
def checkCapability(self, capability):
|
||||
if self.ignore:
|
||||
|
@ -223,6 +223,10 @@ class IrcUserTestCase(unittest.TestCase):
|
||||
self.failIf(u.checkCapability('foo'))
|
||||
self.failUnless(u.checkCapability('!foo'))
|
||||
|
||||
def testRemoveCapability(self):
|
||||
u = ircdb.IrcUser(capabilities=('foo',))
|
||||
self.assertRaises(KeyError, u.removeCapability, 'bar')
|
||||
|
||||
class IrcChannelTestCase(unittest.TestCase):
|
||||
def testInit(self):
|
||||
c = ircdb.IrcChannel()
|
||||
|
Loading…
Reference in New Issue
Block a user