summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/adapter/mailstore/leap_mailstore.py9
-rw-r--r--service/pixelated/adapter/search/__init__.py6
-rw-r--r--service/test/functional/features/steps/mail_list.py1
-rw-r--r--service/test/integration/test_soledad_querier.py2
-rw-r--r--service/test/unit/adapter/mailstore/test_leap_mailstore.py2
-rw-r--r--service/test/unit/adapter/search/test_search.py3
6 files changed, 17 insertions, 6 deletions
diff --git a/service/pixelated/adapter/mailstore/leap_mailstore.py b/service/pixelated/adapter/mailstore/leap_mailstore.py
index 8831ae84..a641c35b 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 email.header import decode_header
from uuid import uuid4
from leap.mail.adaptors.soledad import SoledadMailAdaptor
from twisted.internet import defer
@@ -64,9 +65,13 @@ class LeapMail(Mail):
@property
def raw(self):
- result = ''
+ result = u''
for k, v in self._headers.items():
- result += '%s: %s\n' % (k, v)
+ content, encoding = decode_header(v)[0]
+ if encoding:
+ result += '%s: %s\n' % (k, unicode(content, encoding=encoding))
+ else:
+ result += '%s: %s\n' % (k, v)
result += '\n'
if self._body:
diff --git a/service/pixelated/adapter/search/__init__.py b/service/pixelated/adapter/search/__init__.py
index a95055d2..e1ce5e8c 100644
--- a/service/pixelated/adapter/search/__init__.py
+++ b/service/pixelated/adapter/search/__init__.py
@@ -129,9 +129,9 @@ class SearchEngine(object):
'sender': self._unicode_header_field(header.get('from', '')),
'subject': self._unicode_header_field(header.get('subject', '')),
'date': milliseconds(header.get('date', '')),
- 'to': u','.join([h.decode('utf-8') for h in header.get('to', [''])]),
- 'cc': u','.join([h.decode('utf-8') for h in header.get('cc', [''])]),
- 'bcc': u','.join([h.decode('utf-8') for h in header.get('bcc', [''])]),
+ 'to': u','.join([h for h in header.get('to', [''])]),
+ 'cc': u','.join([h for h in header.get('cc', [''])]),
+ 'bcc': u','.join([h for h in header.get('bcc', [''])]),
'tag': u','.join(unique(tags)),
'bounced': u','.join(bounced),
'body': unicode(mdict['textPlainBody'] if 'textPlainBody' in mdict else mdict['body']),
diff --git a/service/test/functional/features/steps/mail_list.py b/service/test/functional/features/steps/mail_list.py
index 5f0a0116..1875cb58 100644
--- a/service/test/functional/features/steps/mail_list.py
+++ b/service/test/functional/features/steps/mail_list.py
@@ -19,6 +19,7 @@ from time import sleep
def find_current_mail(context):
+ print 'searching for mail [%s]' % context.current_mail_id
return find_element_by_id(context, '%s' % context.current_mail_id)
diff --git a/service/test/integration/test_soledad_querier.py b/service/test/integration/test_soledad_querier.py
index ebe2f13c..5a24968b 100644
--- a/service/test/integration/test_soledad_querier.py
+++ b/service/test/integration/test_soledad_querier.py
@@ -15,12 +15,14 @@
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
import time
+from unittest import skip
from test.support.integration import SoledadTestBase, MailBuilder
from leap.mail.adaptors.soledad import MailboxWrapper
from twisted.internet import defer
+@skip('No longer needed')
class SoledadQuerierTest(SoledadTestBase):
def setUp(self):
diff --git a/service/test/unit/adapter/mailstore/test_leap_mailstore.py b/service/test/unit/adapter/mailstore/test_leap_mailstore.py
index 8c20ab8b..df9f8aeb 100644
--- a/service/test/unit/adapter/mailstore/test_leap_mailstore.py
+++ b/service/test/unit/adapter/mailstore/test_leap_mailstore.py
@@ -386,6 +386,8 @@ class TestLeapMailStore(TestCase):
self._mock_create_doc(hdoc_id, wrapper.hdoc)
self._mock_create_doc(cdoc_id, wrapper.cdocs[1])
+ self._mock_soledad_doc(cdoc_id, wrapper.cdocs[1])
+
return msg
def _convert_mail_to_leap_message(self, mail, mbox_uuid=None):
diff --git a/service/test/unit/adapter/search/test_search.py b/service/test/unit/adapter/search/test_search.py
index 1d9076a2..3d6a050f 100644
--- a/service/test/unit/adapter/search/test_search.py
+++ b/service/test/unit/adapter/search/test_search.py
@@ -16,6 +16,7 @@
import unittest
+from pixelated.adapter.mailstore.leap_mailstore import LeapMail
from pixelated.adapter.search import SearchEngine
from tempdir import TempDir
from test.support import test_helper
@@ -56,7 +57,7 @@ class SearchEngineTest(unittest.TestCase):
}
# when
- se.index_mail(test_helper.pixelated_mail(extra_headers=headers, chash='mailid'))
+ se.index_mail(LeapMail('mailid', 'INBOX', headers=headers)) # test_helper.pixelated_mail(extra_headers=headers, chash='mailid'))
result = se.search('folker')