mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-10 06:48:19 +02:00
Adding a more-versatile condition-handling method for preventing integration tests from mashing on one another.
This commit is contained in:
parent
3e1f6b9909
commit
988cb7504f
6 changed files with 17 additions and 17 deletions
|
|
@ -28,7 +28,7 @@ class Pop3Transport(EmailTransport):
|
|||
return six.binary_type('\r\n', 'ascii').join(message_lines)
|
||||
return '\r\n'.join(message_lines)
|
||||
|
||||
def get_message(self):
|
||||
def get_message(self, condition=None):
|
||||
message_count = len(self.server.list()[1])
|
||||
for i in range(message_count):
|
||||
try:
|
||||
|
|
@ -36,6 +36,10 @@ class Pop3Transport(EmailTransport):
|
|||
self.server.retr(i + 1)[1]
|
||||
)
|
||||
message = self.get_email_from_bytes(msg_contents)
|
||||
|
||||
if condition and not condition(message):
|
||||
continue
|
||||
|
||||
yield message
|
||||
except MessageParseError:
|
||||
continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue