Пример #1
0
    def testCountMessages(self):
        d = defer.succeed(None)

        for i in xrange(15):
            d.addCallback(lambda _: messageFrequencyCheck(domain=getDefaultDomain(), message=self.message1, storage="testStorage", count=16, timeout=10). \
                addCallback(self.assertTrue))

        d.addCallback(lambda _: messageFrequencyCheck(domain=getDefaultDomain(), message=self.message1, storage="testStorage", count=16, timeout=10). \
            addCallback(self.assertFalse)).addCallback(lambda _: advanceTestTimer(10)). \
        addCallback(lambda _: messageFrequencyCheck(domain=getDefaultDomain(), message=self.message1, storage="testStorage", count=16, timeout=10). \
            addCallback(self.assertTrue))

        return d
Пример #2
0
 def testFrequencyCheckOneUser(self):
     return messageFrequencyCheck(domain=getDefaultDomain(), message=self.message3, storage="testStorage", timeout=10, count=2). \
             addCallback(self.assertTrue)