summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/adapter/mailstore/body_parser.py4
-rw-r--r--service/pixelated/adapter/mailstore/leap_mailstore.py4
-rw-r--r--service/test/integration/test_search.py21
-rw-r--r--service/test/unit/adapter/mailstore/test_body_parser.py2
-rw-r--r--service/test/unit/adapter/mailstore/test_leap_mailstore.py8
-rw-r--r--service/test/unit/adapter/search/test_search.py2
6 files changed, 10 insertions, 31 deletions
diff --git a/service/pixelated/adapter/mailstore/body_parser.py b/service/pixelated/adapter/mailstore/body_parser.py
index 893daac9..c79e11a4 100644
--- a/service/pixelated/adapter/mailstore/body_parser.py
+++ b/service/pixelated/adapter/mailstore/body_parser.py
@@ -27,7 +27,7 @@ class BodyParser(object):
def parsed_content(self):
parser = Parser()
- text=''
+ text = ''
text += 'Content-Type: %s\n' % self._content_type
if self._content_transfer_encoding is not None:
text += 'Content-Transfer-Encoding: %s\n' % self._content_transfer_encoding
@@ -38,4 +38,4 @@ class BodyParser(object):
result = unicode(parsed_body.get_payload(decode=True), encoding='utf-8')
- return unicode(result) \ No newline at end of file
+ return unicode(result)
diff --git a/service/pixelated/adapter/mailstore/leap_mailstore.py b/service/pixelated/adapter/mailstore/leap_mailstore.py
index df9a9b44..f03e2900 100644
--- a/service/pixelated/adapter/mailstore/leap_mailstore.py
+++ b/service/pixelated/adapter/mailstore/leap_mailstore.py
@@ -32,7 +32,7 @@ class LeapMail(Mail):
self._headers = headers if headers is not None else {}
self._body = body
self.tags = set(tags) # TODO test that asserts copy
- self._flags = set(flags) # TODO test that asserts copy
+ self._flags = set(flags) # TODO test that asserts copy
@property
def headers(self):
@@ -149,7 +149,7 @@ class LeapMailStore(MailStore):
message = yield self._fetch_msg_from_soledad(mail.mail_id)
message.get_wrapper().set_tags(tuple(mail.tags))
message.get_wrapper().set_flags(tuple(mail.flags))
- yield self._update_mail(message) # TODO assert this is yielded (otherwise asynchronous)
+ yield self._update_mail(message) # TODO assert this is yielded (otherwise asynchronous)
@defer.inlineCallbacks
def all_mails(self):
diff --git a/service/test/integration/test_search.py b/service/test/integration/test_search.py
index 23f2bba8..aafcb4fc 100644
--- a/service/test/integration/test_search.py
+++ b/service/test/integration/test_search.py
@@ -13,32 +13,11 @@
#
# 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.parser import Parser
-from leap.mail import walk
-from leap.mail.utils import first
-from leap.mail.walk import get_hash, get_payloads
from test.support.integration import SoledadTestBase, MailBuilder
from twisted.internet import defer
-def get_raw_docs(msg, parts):
- return (
- {
- "type": "cnt", # type content they'll be
- "raw": payload,
- "phash": get_hash(payload),
- "content-disposition": first(headers.get(
- 'content-disposition', '').split(';')),
- "content-type": headers.get(
- 'content-type', ''),
- "content-transfer-encoding": headers.get(
- 'content-transfer-encoding', '')
- } for payload, headers in get_payloads(msg)
- if not isinstance(payload, list))
-
-walk.get_raw_docs = get_raw_docs
-
class SearchTest(SoledadTestBase):
@defer.inlineCallbacks
diff --git a/service/test/unit/adapter/mailstore/test_body_parser.py b/service/test/unit/adapter/mailstore/test_body_parser.py
index 1af4ce50..eeb1a2ed 100644
--- a/service/test/unit/adapter/mailstore/test_body_parser.py
+++ b/service/test/unit/adapter/mailstore/test_body_parser.py
@@ -27,4 +27,4 @@ class BodyParserTest(unittest.TestCase):
def test_base64_text(self):
parser = BodyParser('dGVzdCB0ZXh0\n', content_type='text/plain; charset="utf-8"', content_transfer_encoding='base64')
- self.assertEqual('test text', parser.parsed_content()) \ No newline at end of file
+ self.assertEqual('test text', parser.parsed_content())
diff --git a/service/test/unit/adapter/mailstore/test_leap_mailstore.py b/service/test/unit/adapter/mailstore/test_leap_mailstore.py
index 3d4df334..4789f02c 100644
--- a/service/test/unit/adapter/mailstore/test_leap_mailstore.py
+++ b/service/test/unit/adapter/mailstore/test_leap_mailstore.py
@@ -45,17 +45,17 @@ class TestLeapMail(TestCase):
def test_email_addresses_in_to_are_split_into_a_list(self):
mail = LeapMail('', 'INBOX', {'To': 'first@example.test,second@example.test'})
- self.assertEqual(['first@example.test', 'second@example.test'],mail.headers['To'])
+ self.assertEqual(['first@example.test', 'second@example.test'], mail.headers['To'])
def test_email_addresses_in_cc_are_split_into_a_list(self):
mail = LeapMail('', 'INBOX', {'Cc': 'first@example.test,second@example.test'})
- self.assertEqual(['first@example.test', 'second@example.test'],mail.headers['Cc'])
+ self.assertEqual(['first@example.test', 'second@example.test'], mail.headers['Cc'])
def test_email_addresses_in_bcc_are_split_into_a_list(self):
mail = LeapMail('', 'INBOX', {'Bcc': 'first@example.test,second@example.test'})
- self.assertEqual(['first@example.test', 'second@example.test'],mail.headers['Bcc'])
+ self.assertEqual(['first@example.test', 'second@example.test'], mail.headers['Bcc'])
def test_email_addresses_might_be_empty_array(self):
mail = LeapMail('', 'INBOX', {'Cc': None})
@@ -103,7 +103,7 @@ class TestLeapMail(TestCase):
self.assertEqual(expected_raw, result)
def test_headers_none_recipients_are_converted_to_empty_array(self):
- mail = LeapMail('id', 'INBOX', {'To':None, 'Cc': None, 'Bcc': None})
+ mail = LeapMail('id', 'INBOX', {'To': None, 'Cc': None, 'Bcc': None})
self.assertEquals([], mail.headers['To'])
self.assertEquals([], mail.headers['Cc'])
diff --git a/service/test/unit/adapter/search/test_search.py b/service/test/unit/adapter/search/test_search.py
index 3d6a050f..76e704b6 100644
--- a/service/test/unit/adapter/search/test_search.py
+++ b/service/test/unit/adapter/search/test_search.py
@@ -57,7 +57,7 @@ class SearchEngineTest(unittest.TestCase):
}
# when
- se.index_mail(LeapMail('mailid', 'INBOX', headers=headers)) # 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')