1
0
Fork 0

Move the bulk get_new_mail to queryset

This commit is contained in:
George Cheng 2020-07-26 14:21:21 +08:00
parent 505bc8d1c9
commit 0c6f6aa6ce
3 changed files with 27 additions and 7 deletions

View file

@ -34,3 +34,13 @@ class TestMailbox(TestCase):
self.assertEqual(mailbox.last_polling, None)
list(mailbox.get_new_mail())
self.assertNotEqual(mailbox.last_polling, None)
def test_queryset_get_new_mail(self):
mailbox = Mailbox.objects.create(uri="mbox://" + os.path.join(
os.path.dirname(__file__),
'messages',
'generic_message.eml',
))
Mailbox.objects.filter(pk=mailbox.pk).get_new_mail()
mailbox.refresh_from_db()
self.assertNotEqual(mailbox.last_polling, None)