diff options
| author | Kali Kaneko <kali@leap.se> | 2015-02-26 13:10:18 -0400 | 
|---|---|---|
| committer | Kali Kaneko <kali@leap.se> | 2015-03-03 14:27:03 -0400 | 
| commit | 7704bacf843c26441b53cff2cbd57f34efdf2af5 (patch) | |
| tree | 5482aaaca6ecfa9b78e50ef3fac4f27d25151264 /mail/src | |
| parent | e7a2e303aaa74fc0b238a84972f023c7df3c4ed9 (diff) | |
fix rename_mailbox implementation, make test pass
Diffstat (limited to 'mail/src')
| -rw-r--r-- | mail/src/leap/mail/mail.py | 10 | ||||
| -rw-r--r-- | mail/src/leap/mail/tests/test_mail.py | 6 | 
2 files changed, 6 insertions, 10 deletions
| diff --git a/mail/src/leap/mail/mail.py b/mail/src/leap/mail/mail.py index 37ab829..9906ddf 100644 --- a/mail/src/leap/mail/mail.py +++ b/mail/src/leap/mail/mail.py @@ -816,16 +816,12 @@ class Account(object):          return d      def rename_mailbox(self, oldname, newname): -        # TODO incomplete/wrong!!! -        # Should rename also ALL of the document ids that are pointing -        # to the old mailbox!!! - -        # TODO part-docs identifiers should have the UID_validity of the -        # mailbox embedded, instead of the name! (so they can survive a rename)          def _rename_mbox(wrapper):              wrapper.mbox = newname -            return wrapper, wrapper.update(self.store) +            d = wrapper.update(self.store) +            d.addCallback(lambda result: wrapper) +            return d          d = self.adaptor.get_or_create_mbox(self.store, oldname)          d.addCallback(_rename_mbox) diff --git a/mail/src/leap/mail/tests/test_mail.py b/mail/src/leap/mail/tests/test_mail.py index 24dcc8b..d326ca8 100644 --- a/mail/src/leap/mail/tests/test_mail.py +++ b/mail/src/leap/mail/tests/test_mail.py @@ -342,9 +342,9 @@ class AccountTestCase(SoledadTestMixin):      def test_rename_mailbox(self):          acc = self.get_account() -        d = acc.callWhenReady(lambda _: acc.add_mailbox("TestMailbox")) -        d = acc.callWhenReady(lambda _: acc.rename_mailbox( -            "TestMailbox", "RenamedMailbox")) +        d = acc.callWhenReady(lambda _: acc.add_mailbox("OriginalMailbox")) +        d.addCallback(lambda _: acc.rename_mailbox( +            "OriginalMailbox", "RenamedMailbox"))          d.addCallback(lambda _: acc.list_all_mailbox_names())          d.addCallback(self._test_rename_mailbox_cb)          return d | 
