1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-09 22:38:19 +02:00

Add tests to update Mailbox.last_polling

This commit is contained in:
Adam Dobrawy 2016-08-16 01:00:52 +02:00
parent 086bcd3acd
commit e8bcd56727

View file

@ -1,3 +1,5 @@
import os
from django.test import TestCase
from django_mailbox.models import Mailbox
@ -18,3 +20,17 @@ class TestMailbox(TestCase):
expected_protocol,
actual_protocol,
)
def test_last_polling_field_exists(self):
mailbox = Mailbox()
self.assertTrue(hasattr(mailbox, 'last_polling'))
def test_get_new_mail_update_last_polling(self):
mailbox = Mailbox.objects.create(uri="mbox://" + os.path.join(
os.path.dirname(__file__),
'messages',
'generic_message.eml',
))
self.assertEqual(mailbox.last_polling, None)
mailbox.get_new_mail()
self.assertNotEqual(mailbox.last_polling, None)