def _fdoc(self, next_uid, mailbox): if self._fd: return self._fd fd = {} fd[fields.MBOX] = mailbox fd[fields.MBOX_UUID] = next_uid fd[fields.CONTENT_HASH] = self._get_chash() fd[SIZE_KEY] = len(self.raw) fd[MULTIPART_KEY] = True fd[fields.RECENT] = True fd[fields.TYPE] = fields.FLAGS fd[fields.FLAGS] = Status.to_flags(self._status) self._fd = fd return fd
def _fdoc(self, next_uid, mailbox): if self._fd: return self._fd fd = {} fd[fields.MBOX_KEY] = mailbox fd[fields.UID_KEY] = next_uid fd[fields.CONTENT_HASH_KEY] = self._get_chash() fd[fields.SIZE_KEY] = len(self.raw) fd[fields.MULTIPART_KEY] = True fd[fields.RECENT_KEY] = True fd[fields.TYPE_KEY] = fields.TYPE_FLAGS_VAL fd[fields.FLAGS_KEY] = Status.to_flags(self._status) self._fd = fd return fd
def test_bulk_conversion(self): statuses = Status.from_flags(['\\Answered', '\\Seen', '\\Recent', 'tag_a_custom']) self.assertEquals(set(['read', 'replied', 'recent']), statuses)
def test_leap_answered_flag_is_translated_to_replied_status(self): status = Status.from_flag('\\Answered') self.assertEquals('replied', status)
def test_leap_seen_flag_is_translated_to_read_status(self): status = Status.from_flag('\\Seen') self.assertEquals('read', status)
def status(self): return Status.from_flags(self.flags)
def with_status(self, flags): for status in Status.from_flags(flags): self.mail['status'].append(status) return self
def is_recent(self): return Status('recent') in self.status
def test_bulk_conversion(self): statuses = Status.from_flags( ['\\Answered', '\\Seen', '\\Recent', 'tag_a_custom']) self.assertEquals(set(['read', 'replied', 'recent']), statuses)