Ejemplo n.º 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())
Ejemplo n.º 2
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())
Ejemplo n.º 3
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)
Ejemplo n.º 4
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)