def test_get_mail_store(self): from pyramid.testing import DummyModel from repoze.mailin.maildir import MaildirStore from repoze.mailin.monitor.models import Messages monitor = DummyModel() monitor.maildir_path = self._getTempdir() o = Messages(monitor) self.failUnless(isinstance(o._mail_store(), MaildirStore))
def test_get_existing_message(self): from repoze.mailin.monitor.models import Messages from repoze.mailin.monitor.models import Message store = DummyMaildirStore(abc='message') def get_store(): return store o = Messages(None) o._mail_store = get_store self.failUnless(isinstance(o['abc'], Message)) self.assertEqual(str(o['abc'].message), 'message')