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

Adding a more-versatile condition-handling method for preventing integration tests from mashing on one another.

This commit is contained in:
Adam Coddington 2015-07-07 22:22:15 -07:00
parent 3e1f6b9909
commit 988cb7504f
6 changed files with 17 additions and 17 deletions

View file

@ -24,12 +24,6 @@ class TestImap(EmailMessageTestCase):
uri=self.get_connection_string()
)
self.arbitrary_identifier = str(uuid.uuid4())
settings.DJANGO_MAILBOX_INTEGRATION_TESTING_SUBJECT = (
self.arbitrary_identifier
)
def tearDown(self):
settings.DJANGO_MAILBOX_INTEGRATION_TESTING_SUBJECT = None
def get_connection_string(self):
return "imap+ssl://{account}:{password}@{server}".format(
@ -50,7 +44,10 @@ class TestImap(EmailMessageTestCase):
)
msg.send()
messages = self._get_new_messages(self.mailbox)
messages = self._get_new_messages(
self.mailbox,
condition=lambda m: m['subject'] == self.arbitrary_identifier
)
self.assertEqual(1, len(messages))
self.assertEqual(messages[0].subject, self.arbitrary_identifier)