Beispiel #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())
Beispiel #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())
Beispiel #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)
Beispiel #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)
Beispiel #5
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())
Beispiel #6
0
 def test_init(self):
     from repoze.mailin.monitor.models import Quarantine
     x = 'x'
     q = Quarantine(x)
     self.failUnless(q.__parent__ is x)
Beispiel #7
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())