From 798ffc624f0a2aa034846a322823caaf3d6f3837 Mon Sep 17 00:00:00 2001 From: Folker Bernitt Date: Tue, 11 Aug 2015 14:59:32 +0200 Subject: Fixed pep8. --- service/test/integration/test_search.py | 21 --------------------- .../test/unit/adapter/mailstore/test_body_parser.py | 2 +- .../unit/adapter/mailstore/test_leap_mailstore.py | 8 ++++---- service/test/unit/adapter/search/test_search.py | 2 +- 4 files changed, 6 insertions(+), 27 deletions(-) (limited to 'service/test') 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 . -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') -- cgit v1.2.3