예제 #1
0
    def test_empty_no(self):
        from repoze.mailin.monitor.models import Quarantine
        from repoze.mailin.pending import PendingQueue
        pending = PendingQueue(None, ':memory:')

        def get_pending_queue():
            return pending

        pending.push('xyz')
        pending.quarantine('abc')
        q = Quarantine(None)
        q._pending_queue = get_pending_queue
        self.failIf(q.empty())
예제 #2
0
    def test_iter(self):
        from repoze.mailin.monitor.models import Quarantine
        from repoze.mailin.pending import PendingQueue
        pending = PendingQueue(None, ':memory:')

        def get_pending_queue():
            return pending

        pending.quarantine('xyz', 'error_msg')
        pending.quarantine('abc', 'it broke')
        q = Quarantine(None)
        q._pending_queue = get_pending_queue
        messages = list(q)
        self.assertEqual(2, len(messages))
        self.assertEqual([('xyz', 'error_msg'), ('abc', 'it broke')], messages)
예제 #3
0
 def test_empty_yes(self):
     from repoze.mailin.monitor.models import MailInMonitor
     from repoze.mailin.monitor.models import Quarantine
     m = MailInMonitor(':memory:', None)
     q = Quarantine(m)
     self.failUnless(q.empty())
예제 #4
0
 def test_init(self):
     from repoze.mailin.monitor.models import Quarantine
     x = 'x'
     q = Quarantine(x)
     self.failUnless(q.__parent__ is x)