예제 #1
0
class MessageDomainTestCase(unittest.TestCase):
    """
    Тест на L{spamfighter.core.message.message.MessageDomain}.
    """
    def setUp(self):
        self.domain = MessageDomain(AttributeDomain(name='aa'), AttributeDomain(name='bb'), AttributeDomain(name='cc'))

    def testInterface(self):
        ziv.verifyClass(IMessageDomain, MessageDomain)

    def testNames(self):
        names = self.domain.names()
        names.sort()
        self.assertEquals(['aa', 'bb', 'cc'], names)

    def testGetItem(self):
        self.assertEquals(AttributeDomain(name='aa'), self.domain['aa'])
        self.assertRaises(KeyError, self.domain.__getitem__, 'xx')
예제 #2
0
 def setUp(self):
     self.domain = MessageDomain(AttributeDomain(name='aa'), AttributeDomain(name='bb'), AttributeDomain(name='cc'))