diff options
21 files changed, 42 insertions, 61 deletions
diff --git a/service/pixelated/adapter/mailstore/leap_attachment_store.py b/service/pixelated/adapter/mailstore/leap_attachment_store.py index 982d9222..c95b776a 100644 --- a/service/pixelated/adapter/mailstore/leap_attachment_store.py +++ b/service/pixelated/adapter/mailstore/leap_attachment_store.py @@ -2,11 +2,11 @@ import quopri import base64 from email import encoders -from leap.mail.adaptors.soledad import SoledadMailAdaptor, ContentDocWrapper +from leap.bitmask.mail.adaptors.soledad import SoledadMailAdaptor, ContentDocWrapper from twisted.internet import defer from email.mime.nonmultipart import MIMENonMultipart from email.mime.multipart import MIMEMultipart -from leap.mail.mail import Message +from leap.bitmask.mail.mail import Message class LeapAttachmentStore(object): diff --git a/service/pixelated/adapter/mailstore/leap_mailstore.py b/service/pixelated/adapter/mailstore/leap_mailstore.py index 97c95a90..900a7cbb 100644 --- a/service/pixelated/adapter/mailstore/leap_mailstore.py +++ b/service/pixelated/adapter/mailstore/leap_mailstore.py @@ -17,8 +17,8 @@ import re from email.header import decode_header from uuid import uuid4 -from leap.mail.adaptors.soledad import SoledadMailAdaptor -from leap.mail.mail import Message +from leap.bitmask.mail.adaptors.soledad import SoledadMailAdaptor +from leap.bitmask.mail.mail import Message from twisted.internet import defer from twisted.internet.defer import FirstError, DeferredList diff --git a/service/pixelated/adapter/mailstore/maintenance/__init__.py b/service/pixelated/adapter/mailstore/maintenance/__init__.py index 2e6c24c6..5dbe57ad 100644 --- a/service/pixelated/adapter/mailstore/maintenance/__init__.py +++ b/service/pixelated/adapter/mailstore/maintenance/__init__.py @@ -13,8 +13,8 @@ # # 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 leap.keymanager import documents as leap_doc -from leap.keymanager.keys import OpenPGPKey +from leap.bitmask.keymanager import documents as leap_doc +from leap.bitmask.keymanager.keys import OpenPGPKey from twisted.internet import defer import logging diff --git a/service/pixelated/adapter/model/mail.py b/service/pixelated/adapter/model/mail.py index 18be9362..86f2642a 100644 --- a/service/pixelated/adapter/model/mail.py +++ b/service/pixelated/adapter/model/mail.py @@ -22,7 +22,7 @@ from hashlib import sha256 import binascii from email.MIMEMultipart import MIMEMultipart from email.mime.nonmultipart import MIMENonMultipart -import leap.mail.walk as walk +import leap.bitmask.mail.walk as walk from pixelated.adapter.model.status import Status from pixelated.support import date diff --git a/service/pixelated/adapter/services/mail_sender.py b/service/pixelated/adapter/services/mail_sender.py index b7b5bfe6..9e506c34 100644 --- a/service/pixelated/adapter/services/mail_sender.py +++ b/service/pixelated/adapter/services/mail_sender.py @@ -16,7 +16,7 @@ from StringIO import StringIO from email.utils import parseaddr from copy import deepcopy -from leap.mail.outgoing.service import OutgoingMail +from leap.bitmask.mail.outgoing.service import OutgoingMail from twisted.internet.defer import Deferred, fail from twisted.mail.smtp import SMTPSenderFactory diff --git a/service/pixelated/adapter/services/mail_service.py b/service/pixelated/adapter/services/mail_service.py index 1dce51fe..e5343997 100644 --- a/service/pixelated/adapter/services/mail_service.py +++ b/service/pixelated/adapter/services/mail_service.py @@ -16,14 +16,14 @@ from email import encoders from email.mime.nonmultipart import MIMENonMultipart from email.mime.multipart import MIMEMultipart -from leap.mail.mail import Message +from leap.bitmask.mail.mail import Message from twisted.internet import defer from pixelated.adapter.model.mail import InputMail from pixelated.adapter.model.status import Status from pixelated.adapter.services.tag_service import extract_reserved_tags -from leap.mail.adaptors.soledad import SoledadMailAdaptor +from leap.bitmask.mail.adaptors.soledad import SoledadMailAdaptor class MailService(object): diff --git a/service/pixelated/bitmask_libraries/keymanager.py b/service/pixelated/bitmask_libraries/keymanager.py index dddc744e..56b7d944 100644 --- a/service/pixelated/bitmask_libraries/keymanager.py +++ b/service/pixelated/bitmask_libraries/keymanager.py @@ -13,7 +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 leap.keymanager import KeyManager, KeyNotFound +from leap.bitmask.keymanager import KeyManager, KeyNotFound from pixelated.config import leap_config from twisted.internet import defer import logging diff --git a/service/pixelated/config/sessions.py b/service/pixelated/config/sessions.py index d38e7b4f..2d186da5 100644 --- a/service/pixelated/config/sessions.py +++ b/service/pixelated/config/sessions.py @@ -12,8 +12,8 @@ from twisted.internet import defer, threads, reactor from leap.soledad.common.crypto import WrongMacError, UnknownMacMethodError from leap.soledad.client import Soledad from pixelated.bitmask_libraries.keymanager import Keymanager -from leap.mail.incoming.service import IncomingMail -from leap.mail.mail import Account +from leap.bitmask.mail.incoming.service import IncomingMail +from leap.bitmask.mail.mail import Account import leap.common.certs as leap_certs from leap.common.events import ( register, unregister, diff --git a/service/pixelated/maintenance.py b/service/pixelated/maintenance.py index 3b216304..6807d9bc 100644 --- a/service/pixelated/maintenance.py +++ b/service/pixelated/maintenance.py @@ -18,7 +18,7 @@ from os.path import isfile from mailbox import Maildir, mbox, MaildirMessage import random -from leap.mail.adaptors.soledad import MetaMsgDocWrapper +from leap.bitmask.mail.adaptors.soledad import MetaMsgDocWrapper from twisted.internet import reactor, defer from twisted.internet.threads import deferToThread from pixelated.adapter.mailstore.maintenance import SoledadMaintenance @@ -26,7 +26,7 @@ from pixelated.config.leap import initialize_leap_single_user from pixelated.config import logger, arguments import logging -from leap.mail.constants import MessageFlags +from leap.bitmask.mail.constants import MessageFlags from pixelated.support.mail_generator import MailGenerator REPAIR_COMMAND = 'repair' diff --git a/service/requirements.txt b/service/requirements.txt index f68c8ad3..a0bca922 100644 --- a/service/requirements.txt +++ b/service/requirements.txt @@ -1,7 +1,5 @@ --index-url https://pypi.python.org/simple/ -https://launchpad.net/dirspec/stable-13-10/13.10/+download/dirspec-13.10.tar.gz -https://launchpad.net/u1db/stable-13-10/13.10/+download/u1db-13.10.tar.bz2 pyasn1==0.1.8 requests==2.9.1 srp==1.0.4 @@ -13,6 +11,4 @@ Twisted==16.1.1 -e 'git+https://github.com/pixelated/soledad.git@develop#egg=leap.soledad.common&subdirectory=common/' -e 'git+https://github.com/pixelated/soledad.git@develop#egg=leap.soledad.client&subdirectory=client/' -e 'git+https://github.com/pixelated/soledad.git@develop#egg=leap.soledad.server&subdirectory=server/' --e 'git+https://github.com/pixelated/keymanager.git@develop#egg=leap.keymanager' --e 'git+https://github.com/pixelated/leap_mail.git@develop#egg=leap.mail' -e . diff --git a/service/test/functional/features/steps/attachments.py b/service/test/functional/features/steps/attachments.py index a319359d..28d88343 100644 --- a/service/test/functional/features/steps/attachments.py +++ b/service/test/functional/features/steps/attachments.py @@ -15,7 +15,7 @@ # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. from email.mime.application import MIMEApplication from time import sleep -from leap.mail.mail import Message +from leap.bitmask.mail.mail import Message from common import * from test.support.integration import MailBuilder from behave import given diff --git a/service/test/integration/test_search.py b/service/test/integration/test_search.py index c36e29aa..afad12b7 100644 --- a/service/test/integration/test_search.py +++ b/service/test/integration/test_search.py @@ -134,14 +134,3 @@ class SearchTest(SoledadTestBase): results = yield self.app_test_client.get_mails_by_tag('inbox') self.assertEqual(results[0].ident, mail2.ident) self.assertEqual(results[1].ident, mail1.ident) - - @defer.inlineCallbacks - def test_search_base64_body(self): - body = u'bl\xe1' - input_mail = MailBuilder().with_body(body.encode('utf-8')).build_input_mail() - - mail = yield self.app_test_client.add_mail_to_inbox(input_mail) - results = yield self.app_test_client.search(body) - - self.assertGreater(len(results), 0, 'No results returned from search') - self.assertEquals(results[0].ident, mail.ident) diff --git a/service/test/support/integration/app_test_client.py b/service/test/support/integration/app_test_client.py index 13cd9f94..4e7b8c66 100644 --- a/service/test/support/integration/app_test_client.py +++ b/service/test/support/integration/app_test_client.py @@ -15,23 +15,25 @@ # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. import json import multiprocessing -from leap.mail.adaptors.soledad import SoledadMailAdaptor -from mockito import mock import os import shutil import time import uuid import random +from tempdir import TempDir - -from leap.mail.mail import Account -from leap.soledad.client import Soledad from mock import Mock +from mockito import mock + +from twisted.cred import checkers, credentials from twisted.internet import reactor, defer from twisted.internet.defer import succeed from twisted.web.resource import getChildForRequest from zope.interface import implementer -from twisted.cred import checkers, credentials + +from leap.bitmask.mail.mail import Account +from leap.soledad.client import Soledad +from leap.bitmask.mail.adaptors.soledad import SoledadMailAdaptor from pixelated.adapter.mailstore.leap_attachment_store import LeapAttachmentStore from pixelated.adapter.services.feedback_service import FeedbackService from pixelated.application import UserAgentMode, set_up_protected_resources @@ -42,7 +44,6 @@ from pixelated.config.authentication import Authentication from pixelated.adapter.mailstore import LeapMailStore from pixelated.adapter.mailstore.searchable_mailstore import SearchableMailStore - from pixelated.adapter.search import SearchEngine from pixelated.adapter.services.draft_service import DraftService from pixelated.adapter.services.mail_service import MailService @@ -50,7 +51,6 @@ from pixelated.resources.root_resource import RootResource from test.support.integration.model import MailBuilder from test.support.test_helper import request_mock from test.support.integration.model import ResponseMail -from tempdir import TempDir class AppTestAccount(object): diff --git a/service/test/support/integration/soledad_test_base.py b/service/test/support/integration/soledad_test_base.py index 0ab07490..6f2d6ed1 100644 --- a/service/test/support/integration/soledad_test_base.py +++ b/service/test/support/integration/soledad_test_base.py @@ -14,8 +14,8 @@ # 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 leap.mail.mail import Message +from leap.bitmask.mail.adaptors.soledad import SoledadMailAdaptor +from leap.bitmask.mail.mail import Message from twisted.internet import defer from twisted.trial import unittest from test.support.integration.app_test_client import AppTestClient diff --git a/service/test/unit/adapter/mailstore/maintenance/test_soledad_maintenance.py b/service/test/unit/adapter/mailstore/maintenance/test_soledad_maintenance.py index be73af93..2aaa969c 100644 --- a/service/test/unit/adapter/mailstore/maintenance/test_soledad_maintenance.py +++ b/service/test/unit/adapter/mailstore/maintenance/test_soledad_maintenance.py @@ -19,7 +19,7 @@ from twisted.internet import defer from twisted.trial import unittest from mockito import mock, when, verify, never from pixelated.adapter.mailstore.maintenance import SoledadMaintenance -from leap.keymanager.openpgp import OpenPGPKey +from leap.bitmask.keymanager.openpgp import OpenPGPKey import logging logging.getLogger('pixelated.adapter.mailstore.maintenance').addHandler(logging.NullHandler()) diff --git a/service/test/unit/adapter/mailstore/test_leap_attachment_store.py b/service/test/unit/adapter/mailstore/test_leap_attachment_store.py index f442b687..2d3daaaa 100644 --- a/service/test/unit/adapter/mailstore/test_leap_attachment_store.py +++ b/service/test/unit/adapter/mailstore/test_leap_attachment_store.py @@ -16,15 +16,15 @@ # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. import json from uuid import uuid4 -import u1db -from leap.mail.adaptors.soledad_indexes import MAIL_INDEXES +from leap.soledad.common import l2db +from leap.bitmask.mail.adaptors.soledad_indexes import MAIL_INDEXES from leap.soledad.common.document import SoledadDocument from mock import patch from mockito import mock, when, verify from twisted.internet import defer from twisted.trial.unittest import TestCase -from leap.mail.adaptors.soledad import SoledadMailAdaptor, MailboxWrapper, ContentDocWrapper +from leap.bitmask.mail.adaptors.soledad import SoledadMailAdaptor, MailboxWrapper, ContentDocWrapper from pixelated.adapter.mailstore.leap_attachment_store import LeapAttachmentStore from test.support.mockito import AnswerSelector @@ -84,7 +84,7 @@ class TestLeapAttachmentStore(TestCase): store = LeapAttachmentStore(self.soledad) - when(self.soledad).create_doc(cdoc_serialized, doc_id=attachment_id).thenRaise(u1db.errors.RevisionConflict()) + when(self.soledad).create_doc(cdoc_serialized, doc_id=attachment_id).thenRaise(l2db.errors.RevisionConflict()) actual_attachment_id = yield store.add_attachment(content, content_type) diff --git a/service/test/unit/adapter/mailstore/test_leap_mailstore.py b/service/test/unit/adapter/mailstore/test_leap_mailstore.py index 62c8ac7a..5e897dd7 100644 --- a/service/test/unit/adapter/mailstore/test_leap_mailstore.py +++ b/service/test/unit/adapter/mailstore/test_leap_mailstore.py @@ -25,16 +25,16 @@ from uuid import uuid4 from email.parser import Parser import os from leap.soledad.common.document import SoledadDocument -from leap.mail.adaptors.soledad_indexes import MAIL_INDEXES +from leap.bitmask.mail.adaptors.soledad_indexes import MAIL_INDEXES from twisted.internet.defer import FirstError from twisted.trial.unittest import TestCase -from leap.mail import constants +from leap.bitmask.mail import constants from twisted.internet import defer from mock import patch from mockito import mock, when, verify, any as ANY -from leap.mail.adaptors.soledad import SoledadMailAdaptor, MailboxWrapper, ContentDocWrapper +from leap.bitmask.mail.adaptors.soledad import SoledadMailAdaptor, MailboxWrapper, ContentDocWrapper import pkg_resources -from leap.mail.mail import Message +from leap.bitmask.mail.mail import Message from pixelated.adapter.mailstore import underscore_uuid from pixelated.adapter.mailstore.leap_mailstore import LeapMailStore, LeapMail @@ -242,7 +242,7 @@ class TestLeapMailStore(TestCase): message = yield store.add_mail('INBOX', input_mail.as_string()) - expected = [{'ident': self._cdoc_phash_from_message(mocked_message, 2), 'name': 'filename.txt', 'encoding': 'base64', 'size': 197, 'content-type': 'application/octet-stream'}] + expected = [{'ident': self._cdoc_phash_from_message(mocked_message, 2), 'name': 'filename.txt', 'encoding': 'base64', 'size': 48, 'content-type': 'application/octet-stream'}] self.assertEqual(expected, message.as_dict()['attachments']) @defer.inlineCallbacks @@ -257,7 +257,7 @@ class TestLeapMailStore(TestCase): message = yield store.add_mail('INBOX', input_mail.as_string()) - expected = [{'ident': self._cdoc_phash_from_message(mocked_message, 2), 'name': 'super_nice_photo.jpg', 'encoding': 'base64', 'size': 202, 'content-type': 'application/octet-stream'}] + expected = [{'ident': self._cdoc_phash_from_message(mocked_message, 2), 'name': 'super_nice_photo.jpg', 'encoding': 'base64', 'size': 48, 'content-type': 'application/octet-stream'}] self.assertEqual(expected, message.as_dict()['attachments']) @defer.inlineCallbacks @@ -274,7 +274,7 @@ class TestLeapMailStore(TestCase): message = yield store.add_mail('INBOX', input_mail.as_string()) - expected = [{'ident': self._cdoc_phash_from_message(mocked_message, 2), 'name': 'filename.txt', 'encoding': 'base64', 'size': 197, 'content-type': 'application/octet-stream'}] + expected = [{'ident': self._cdoc_phash_from_message(mocked_message, 2), 'name': 'filename.txt', 'encoding': 'base64', 'size': 48, 'content-type': 'application/octet-stream'}] self.assertEqual(expected, message.as_dict()['attachments']) def test_extract_attachment_filename_with_or_without_quotes(self): diff --git a/service/test/unit/adapter/services/test_mail_sender.py b/service/test/unit/adapter/services/test_mail_sender.py index 863ac81a..4daa7f24 100644 --- a/service/test/unit/adapter/services/test_mail_sender.py +++ b/service/test/unit/adapter/services/test_mail_sender.py @@ -13,7 +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 leap.mail.outgoing.service import OutgoingMail +from leap.bitmask.mail.outgoing.service import OutgoingMail from twisted.mail.smtp import User from twisted.trial import unittest diff --git a/service/test/unit/resources/test_keys_resources.py b/service/test/unit/resources/test_keys_resources.py index a7c885ca..17297206 100644 --- a/service/test/unit/resources/test_keys_resources.py +++ b/service/test/unit/resources/test_keys_resources.py @@ -1,8 +1,8 @@ import json import ast from mockito import mock, when, any as ANY -from leap.keymanager import KeyNotFound -from leap.keymanager.keys import OpenPGPKey +from leap.bitmask.keymanager import KeyNotFound +from leap.bitmask.keymanager.keys import OpenPGPKey from pixelated.application import UserAgentMode from pixelated.config.services import ServicesFactory diff --git a/service/test/unit/resources/test_logout_resources.py b/service/test/unit/resources/test_logout_resources.py index 845fcde9..33c8537f 100644 --- a/service/test/unit/resources/test_logout_resources.py +++ b/service/test/unit/resources/test_logout_resources.py @@ -1,5 +1,3 @@ -import logging - from mock import patch, MagicMock from twisted.internet import defer from twisted.trial import unittest @@ -9,8 +7,6 @@ from twisted.web.test.requesthelper import DummyRequest from pixelated.resources.logout_resource import LogoutResource from test.unit.resources import DummySite -logging.getLogger('pixelated.resources').addHandler(logging.NullHandler()) - class TestLogoutResource(unittest.TestCase): def setUp(self): diff --git a/service/test/unit/resources/test_user_settings_resource.py b/service/test/unit/resources/test_user_settings_resource.py index a33ad571..30a3c4cd 100644 --- a/service/test/unit/resources/test_user_settings_resource.py +++ b/service/test/unit/resources/test_user_settings_resource.py @@ -7,7 +7,7 @@ from pixelated.resources.user_settings_resource import UserSettingsResource, FIN from mockito import mock, when, any from test.unit.resources import DummySite from twisted.web.test.requesthelper import DummyRequest -from leap.keymanager.keys import OpenPGPKey +from leap.bitmask.keymanager.keys import OpenPGPKey from twisted.internet import defer from twisted.python.failure import Failure |