diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-07 09:30:51 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-11 17:00:33 +0200 |
commit | 6b588bb4cb93f8e265d044ea784cb18b7021b26c (patch) | |
tree | 01eacc11e8c6bf0a21312cc9b9295f68872130a0 /service/pixelated/adapter/mailstore/leap_mailstore.py | |
parent | 08497951fa9aed8d28be8b2dea1aef2135f56769 (diff) |
Changed test_delete_mail.py integration test to new mail store.
- intermediate state, some tests are broken
Diffstat (limited to 'service/pixelated/adapter/mailstore/leap_mailstore.py')
-rw-r--r-- | service/pixelated/adapter/mailstore/leap_mailstore.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/service/pixelated/adapter/mailstore/leap_mailstore.py b/service/pixelated/adapter/mailstore/leap_mailstore.py index c3c93cc3..c34d2b16 100644 --- a/service/pixelated/adapter/mailstore/leap_mailstore.py +++ b/service/pixelated/adapter/mailstore/leap_mailstore.py @@ -13,6 +13,7 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. +from uuid import uuid4 from leap.mail.adaptors.soledad import SoledadMailAdaptor from twisted.internet import defer from pixelated.adapter.mailstore.mailstore import MailStore, underscore_uuid @@ -32,6 +33,10 @@ class LeapMail(Mail): self._flags = flags @property + def ident(self): + return self._mail_id + + @property def mail_id(self): return self._mail_id @@ -84,6 +89,8 @@ class LeapMailStore(MailStore): defer.returnValue(leap_mail) except AttributeError, e: + import traceback + traceback.print_exc() defer.returnValue(None) def get_mails(self, mail_ids): @@ -199,12 +206,24 @@ class LeapMailStore(MailStore): map = (yield self._mailbox_uuid_to_name_map()) defer.returnValue(map[uuid]) + @defer.inlineCallbacks def _get_or_create_mailbox(self, mailbox_name): - return SoledadMailAdaptor().get_or_create_mbox(self.soledad, mailbox_name) + mailbox_name_upper = mailbox_name.upper() + mbx = yield SoledadMailAdaptor().get_or_create_mbox(self.soledad, mailbox_name_upper) + if mbx.uuid is None: + mbx.uuid = str(uuid4()) + yield mbx.update(self.soledad) + defer.returnValue(mbx) def _fetch_msg_from_soledad(self, mail_id, load_body=False): return SoledadMailAdaptor().get_msg_from_mdoc_id(Message, self.soledad, mail_id, get_cdocs=load_body) + @defer.inlineCallbacks + def _dump_soledad(self): + gen, docs = yield self.soledad.get_all_docs() + for doc in docs: + print '\n%s\n' % doc + def _is_empty_message(message): return (message is None) or (message.get_wrapper().mdoc.doc_id is None) |