mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 04:02:46 +01:00
New tests.
This commit is contained in:
parent
d9ca1637d7
commit
ebb30d7530
@ -34,6 +34,7 @@ from test import *
|
|||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
import conf
|
||||||
import debug
|
import debug
|
||||||
import ircdb
|
import ircdb
|
||||||
import ircutils
|
import ircutils
|
||||||
@ -90,11 +91,20 @@ class CapabilitySetTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class UserCapabilitySetTestCase(unittest.TestCase):
|
class UserCapabilitySetTestCase(unittest.TestCase):
|
||||||
def test(self):
|
def testOwnerHasAll(self):
|
||||||
d = ircdb.UserCapabilitySet(('owner',))
|
d = ircdb.UserCapabilitySet(('owner',))
|
||||||
self.failIf(d.check('!foo'))
|
self.failIf(d.check('!foo'))
|
||||||
self.failUnless(d.check('foo'))
|
self.failUnless(d.check('foo'))
|
||||||
|
|
||||||
|
def testOwnerIsAlwaysPresent(self):
|
||||||
|
d = ircdb.UserCapabilitySet()
|
||||||
|
self.failUnless('owner' in d)
|
||||||
|
self.failUnless('!owner' in d)
|
||||||
|
self.failIf(d.check('owner'))
|
||||||
|
d.add('owner')
|
||||||
|
self.failUnless(d.check('owner'))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CapabilitySetTestCase(unittest.TestCase):
|
class CapabilitySetTestCase(unittest.TestCase):
|
||||||
def testContains(self):
|
def testContains(self):
|
||||||
@ -358,8 +368,10 @@ class CheckCapabilityTestCase(unittest.TestCase):
|
|||||||
self.failUnless(self.checkCapability(self.nothing, self.antichancap))
|
self.failUnless(self.checkCapability(self.nothing, self.antichancap))
|
||||||
|
|
||||||
def testNothing(self):
|
def testNothing(self):
|
||||||
self.failIf(self.checkCapability(self.nothing, self.cap))
|
self.assertEqual(self.checkCapability(self.nothing, self.cap),
|
||||||
self.failIf(self.checkCapability(self.nothing, self.anticap))
|
conf.defaultAllow)
|
||||||
|
self.assertEqual(self.checkCapability(self.nothing, self.anticap),
|
||||||
|
not conf.defaultAllow)
|
||||||
|
|
||||||
def testJustFoo(self):
|
def testJustFoo(self):
|
||||||
self.failUnless(self.checkCapability(self.justfoo, self.cap))
|
self.failUnless(self.checkCapability(self.justfoo, self.cap))
|
||||||
|
Loading…
Reference in New Issue
Block a user