diff options
l--------- | src/leap/bitmask/mail/imap/tests/rfc822.message | 1 | ||||
-rw-r--r-- | tests/integration/bonafide/test_bonafide_stub.py | 5 | ||||
-rw-r--r-- | tests/integration/cli/test_cli_stub.py | 5 | ||||
-rw-r--r-- | tests/integration/core/test_core_stub.py | 5 | ||||
-rw-r--r-- | tests/integration/keymanager/common.py (renamed from tests/keymanager/common.py) | 3 | ||||
-rw-r--r-- | tests/integration/keymanager/fixtures/private_key.bin (renamed from tests/keymanager/fixtures/private_key.bin) | bin | 2202 -> 2202 bytes | |||
-rw-r--r-- | tests/integration/keymanager/fixtures/public_key.bin (renamed from tests/keymanager/fixtures/public_key.bin) | bin | 2202 -> 2202 bytes | |||
-rw-r--r-- | tests/integration/keymanager/test_keymanager.py (renamed from tests/keymanager/test_keymanager.py) | 56 | ||||
-rw-r--r-- | tests/integration/keymanager/test_migrator.py (renamed from tests/keymanager/test_migrator.py) | 12 | ||||
-rw-r--r-- | tests/integration/keymanager/test_openpgp.py (renamed from tests/keymanager/test_openpgp.py) | 12 | ||||
-rw-r--r-- | tests/integration/keymanager/test_validation.py (renamed from tests/keymanager/test_validation.py) | 9 | ||||
-rw-r--r-- | tests/integration/mail/adaptors/test_models.py (renamed from src/leap/bitmask/mail/adaptors/tests/test_models.py) | 4 | ||||
-rw-r--r-- | tests/integration/mail/adaptors/test_soledad_adaptor.py (renamed from src/leap/bitmask/mail/adaptors/tests/test_soledad_adaptor.py) | 22 | ||||
-rw-r--r-- | tests/integration/mail/imap/.gitignore (renamed from src/leap/bitmask/mail/imap/tests/.gitignore) | 0 | ||||
-rwxr-xr-x | tests/integration/mail/imap/getmail (renamed from src/leap/bitmask/mail/imap/tests/getmail) | 0 | ||||
-rwxr-xr-x | tests/integration/mail/imap/imapclient.py (renamed from src/leap/bitmask/mail/imap/tests/imapclient.py) | 0 | ||||
-rwxr-xr-x | tests/integration/mail/imap/regressions_mime_struct (renamed from src/leap/bitmask/mail/imap/tests/regressions_mime_struct) | 0 | ||||
l--------- | tests/integration/mail/imap/rfc822.message (renamed from src/leap/bitmask/mail/adaptors/tests/rfc822.message) | 0 | ||||
l--------- | tests/integration/mail/imap/rfc822.multi-minimal.message (renamed from src/leap/bitmask/mail/imap/tests/rfc822.multi-minimal.message) | 0 | ||||
l--------- | tests/integration/mail/imap/rfc822.multi-nested.message (renamed from src/leap/bitmask/mail/imap/tests/rfc822.multi-nested.message) | 0 | ||||
l--------- | tests/integration/mail/imap/rfc822.multi-signed.message (renamed from src/leap/bitmask/mail/imap/tests/rfc822.multi-signed.message) | 0 | ||||
l--------- | tests/integration/mail/imap/rfc822.multi.message (renamed from src/leap/bitmask/mail/imap/tests/rfc822.multi.message) | 0 | ||||
l--------- | tests/integration/mail/imap/rfc822.plain.message (renamed from src/leap/bitmask/mail/imap/tests/rfc822.plain.message) | 0 | ||||
-rwxr-xr-x | tests/integration/mail/imap/stress_tests_imap.zsh (renamed from src/leap/bitmask/mail/imap/tests/stress_tests_imap.zsh) | 0 | ||||
-rw-r--r-- | tests/integration/mail/imap/test_imap.py (renamed from src/leap/bitmask/mail/imap/tests/test_imap.py) | 16 | ||||
-rw-r--r-- | tests/integration/mail/imap/walktree.py (renamed from src/leap/bitmask/mail/imap/tests/walktree.py) | 2 | ||||
-rw-r--r-- | tests/integration/mail/incoming/rfc822.multi-encrypt-signed.message (renamed from src/leap/bitmask/mail/incoming/tests/rfc822.multi-encrypt-signed.message) | 0 | ||||
-rw-r--r-- | tests/integration/mail/incoming/test_incoming_mail.py (renamed from src/leap/bitmask/mail/incoming/tests/test_incoming_mail.py) | 27 | ||||
-rw-r--r-- | tests/integration/mail/outgoing/test_outgoing.py (renamed from src/leap/bitmask/mail/outgoing/tests/test_outgoing.py) | 14 | ||||
-rw-r--r-- | tests/integration/mail/rfc822.bounce.message (renamed from src/leap/bitmask/mail/tests/rfc822.bounce.message) | 0 | ||||
-rw-r--r-- | tests/integration/mail/rfc822.message (renamed from src/leap/bitmask/mail/tests/rfc822.message) | 0 | ||||
-rw-r--r-- | tests/integration/mail/rfc822.multi-minimal.message (renamed from src/leap/bitmask/mail/tests/rfc822.multi-minimal.message) | 0 | ||||
-rw-r--r-- | tests/integration/mail/rfc822.multi-nested.message (renamed from src/leap/bitmask/mail/tests/rfc822.multi-nested.message) | 0 | ||||
-rw-r--r-- | tests/integration/mail/rfc822.multi-signed.message (renamed from src/leap/bitmask/mail/tests/rfc822.multi-signed.message) | 0 | ||||
-rw-r--r-- | tests/integration/mail/rfc822.multi.message (renamed from src/leap/bitmask/mail/tests/rfc822.multi.message) | 0 | ||||
-rw-r--r-- | tests/integration/mail/rfc822.plain.message (renamed from src/leap/bitmask/mail/tests/rfc822.plain.message) | 0 | ||||
-rw-r--r-- | tests/integration/mail/smtp/185CA770.key (renamed from src/leap/bitmask/mail/smtp/tests/185CA770.key) | 0 | ||||
-rw-r--r-- | tests/integration/mail/smtp/185CA770.pub (renamed from src/leap/bitmask/mail/smtp/tests/185CA770.pub) | 0 | ||||
-rw-r--r-- | tests/integration/mail/smtp/cert/server.crt (renamed from src/leap/bitmask/mail/smtp/tests/cert/server.crt) | 0 | ||||
-rw-r--r-- | tests/integration/mail/smtp/cert/server.key (renamed from src/leap/bitmask/mail/smtp/tests/cert/server.key) | 0 | ||||
-rw-r--r-- | tests/integration/mail/smtp/mail.txt (renamed from src/leap/bitmask/mail/smtp/tests/mail.txt) | 0 | ||||
-rw-r--r-- | tests/integration/mail/smtp/test_gateway.py (renamed from src/leap/bitmask/mail/smtp/tests/test_gateway.py) | 8 | ||||
-rw-r--r-- | tests/integration/mail/test_mail.py (renamed from src/leap/bitmask/mail/tests/test_mail.py) | 10 | ||||
-rw-r--r-- | tests/integration/mail/test_mailbox_indexer.py (renamed from src/leap/bitmask/mail/tests/test_mailbox_indexer.py) | 4 | ||||
-rw-r--r-- | tests/integration/mail/test_walk.py (renamed from src/leap/bitmask/mail/tests/test_walk.py) | 2 | ||||
-rw-r--r-- | tests/unit/readme.txt | 4 |
46 files changed, 116 insertions, 105 deletions
diff --git a/src/leap/bitmask/mail/imap/tests/rfc822.message b/src/leap/bitmask/mail/imap/tests/rfc822.message deleted file mode 120000 index b19cc28..0000000 --- a/src/leap/bitmask/mail/imap/tests/rfc822.message +++ /dev/null @@ -1 +0,0 @@ -../../tests/rfc822.message
\ No newline at end of file diff --git a/tests/integration/bonafide/test_bonafide_stub.py b/tests/integration/bonafide/test_bonafide_stub.py new file mode 100644 index 0000000..7b1cbbb --- /dev/null +++ b/tests/integration/bonafide/test_bonafide_stub.py @@ -0,0 +1,5 @@ +from leap.bitmask.bonafide import * + + +def test_stub(): + assert True diff --git a/tests/integration/cli/test_cli_stub.py b/tests/integration/cli/test_cli_stub.py new file mode 100644 index 0000000..70713c5 --- /dev/null +++ b/tests/integration/cli/test_cli_stub.py @@ -0,0 +1,5 @@ +from leap.bitmask.cli import * + + +def test_cli_stub(): + assert True diff --git a/tests/integration/core/test_core_stub.py b/tests/integration/core/test_core_stub.py new file mode 100644 index 0000000..ccdeb57 --- /dev/null +++ b/tests/integration/core/test_core_stub.py @@ -0,0 +1,5 @@ +from leap.bitmask.core import * + + +def test_stub(): + assert True diff --git a/tests/keymanager/common.py b/tests/integration/keymanager/common.py index 8eb5d4e..fb8b4ef 100644 --- a/tests/keymanager/common.py +++ b/tests/integration/keymanager/common.py @@ -17,7 +17,6 @@ """ Base classes for the Key Manager tests. """ - import distutils.spawn import os.path @@ -25,8 +24,8 @@ from twisted.internet.defer import gatherResults from twisted.trial import unittest from leap.common.testing.basetest import BaseLeapTest +from leap.bitmask.keymanager import KeyManager from leap.soledad.client import Soledad -from leap.keymanager import KeyManager PATH = os.path.dirname(os.path.realpath(__file__)) diff --git a/tests/keymanager/fixtures/private_key.bin b/tests/integration/keymanager/fixtures/private_key.bin Binary files differindex ab17431..ab17431 100644 --- a/tests/keymanager/fixtures/private_key.bin +++ b/tests/integration/keymanager/fixtures/private_key.bin diff --git a/tests/keymanager/fixtures/public_key.bin b/tests/integration/keymanager/fixtures/public_key.bin Binary files differindex ab17431..ab17431 100644 --- a/tests/keymanager/fixtures/public_key.bin +++ b/tests/integration/keymanager/fixtures/public_key.bin diff --git a/tests/keymanager/test_keymanager.py b/tests/integration/keymanager/test_keymanager.py index b4ab805..568cbd2 100644 --- a/tests/keymanager/test_keymanager.py +++ b/tests/integration/keymanager/test_keymanager.py @@ -14,33 +14,30 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. - - """ -Tests for the Key Manager. +Tests for the KeyManager. """ - -from os import path import json import urllib -from datetime import datetime import tempfile import pkg_resources -from leap.common import ca_bundle -from mock import Mock, MagicMock, patch +from datetime import datetime +from os import path + from twisted.internet import defer from twisted.trial import unittest from twisted.web._responses import NOT_FOUND +import mock -from leap.keymanager import client - -from leap.keymanager import errors -from leap.keymanager.keys import ( +from leap.common import ca_bundle +from leap.bitmask.keymanager import client +from leap.bitmask.keymanager import errors +from leap.bitmask.keymanager.keys import ( OpenPGPKey, is_address, build_key_from_dict, ) -from leap.keymanager.validation import ValidationLevels +from leap.bitmask.keymanager.validation import ValidationLevels from common import ( KeyManagerWithSoledadTestCase, @@ -208,7 +205,8 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase): token = "mytoken" km = self._key_manager(token=token) yield km._openpgp.put_raw_key(PUBLIC_KEY, ADDRESS) - km._async_client_pinned.request = Mock(return_value=defer.succeed('')) + km._async_client_pinned.request = mock.Mock( + return_value=defer.succeed('')) # the following data will be used on the send km.ca_cert_path = 'capath' km.session_id = 'sessionid' @@ -251,8 +249,8 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase): KeyNotFound is raised, with corresponding error message. """ km = self._key_manager(url=NICKSERVER_URI) - client.readBody = Mock(return_value=defer.succeed(None)) - km._async_client_pinned.request = Mock( + client.readBody = mock.Mock(return_value=defer.succeed(None)) + km._async_client_pinned.request = mock.Mock( return_value=defer.succeed(None)) url = NICKSERVER_URI + '?address=' + INVALID_MAIL_ADDRESS @@ -261,7 +259,7 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase): def check_key_not_found_is_raised_if_404(_): used_kwargs = km._async_client_pinned.request.call_args[1] check_404_callback = used_kwargs['callback'] - fake_response = Mock() + fake_response = mock.Mock() fake_response.code = NOT_FOUND with self.assertRaisesRegexp( errors.KeyNotFound, @@ -278,7 +276,7 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase): """ km = self._key_manager(url=NICKSERVER_URI) key_not_found_exception = errors.KeyNotFound('some message') - km._async_client_pinned.request = Mock( + km._async_client_pinned.request = mock.Mock( side_effect=key_not_found_exception) def assert_key_not_found_raised(error): @@ -317,10 +315,10 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase): """ data = json.dumps({'address': address, 'openpgp': key}) - client.readBody = Mock(return_value=defer.succeed(data)) + client.readBody = mock.Mock(return_value=defer.succeed(data)) # mock the fetcher so it returns the key for ADDRESS_2 - km._async_client_pinned.request = Mock( + km._async_client_pinned.request = mock.Mock( return_value=defer.succeed(None)) km.ca_cert_path = 'cacertpath' # try to key get without fetching from server @@ -363,7 +361,8 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase): """ km = self._key_manager() - km._async_client.request = Mock(return_value=defer.succeed(PUBLIC_KEY)) + km._async_client.request = mock.Mock( + return_value=defer.succeed(PUBLIC_KEY)) yield km.fetch_key(ADDRESS, "http://site.domain/key") key = yield km.get_key(ADDRESS) @@ -377,7 +376,7 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase): """ km = self._key_manager() - km._async_client.request = Mock( + km._async_client.request = mock.Mock( return_value=defer.succeed(self.get_public_binary_key())) yield km.fetch_key(ADDRESS, "http://site.domain/key") @@ -390,7 +389,7 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase): """ km = self._key_manager() - km._async_client.request = Mock(return_value=defer.succeed("")) + km._async_client.request = mock.Mock(return_value=defer.succeed("")) d = km.fetch_key(ADDRESS, "http://site.domain/key") return self.assertFailure(d, errors.KeyNotFound) @@ -401,12 +400,14 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase): """ km = self._key_manager() - km._async_client.request = Mock(return_value=defer.succeed(PUBLIC_KEY)) + km._async_client.request = mock.Mock( + return_value=defer.succeed(PUBLIC_KEY)) d = km.fetch_key(ADDRESS_2, "http://site.domain/key") return self.assertFailure(d, errors.KeyAddressMismatch) def _mock_get_response(self, km, body): - km._async_client.request = MagicMock(return_value=defer.succeed(body)) + km._async_client.request = mock.MagicMock( + return_value=defer.succeed(body)) return km._async_client.request @@ -449,8 +450,9 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase): ca_cert_path = tmp_input.name self._dump_to_file(ca_cert_path, ca_content) - with patch('leap.keymanager.tempfile.NamedTemporaryFile') as mock: - mock.return_value = tmp_output + pth = 'leap.bitmask.keymanager.tempfile.NamedTemporaryFile' + with mock.patch(pth) as mocked: + mocked.return_value = tmp_output km = self._key_manager(ca_cert_path=ca_cert_path) get_mock = self._mock_get_response(km, PUBLIC_KEY_OTHER) diff --git a/tests/keymanager/test_migrator.py b/tests/integration/keymanager/test_migrator.py index 64cd8e1..163e57e 100644 --- a/tests/keymanager/test_migrator.py +++ b/tests/integration/keymanager/test_migrator.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # test_migrator.py -# Copyright (C) 2015 LEAP +# Copyright (C) 2015-2016 LEAP # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,19 +14,15 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. - - """ Tests for the migrator. """ - - from collections import namedtuple from mock import Mock from twisted.internet.defer import succeed, inlineCallbacks -from leap.keymanager.migrator import KeyDocumentsMigrator, KEY_ID_KEY -from leap.keymanager.documents import ( +from leap.bitmask.keymanager.migrator import KeyDocumentsMigrator, KEY_ID_KEY +from leap.bitmask.keymanager.documents import ( TAGS_PRIVATE_INDEX, KEYMANAGER_ACTIVE_TAG, KEYMANAGER_KEY_TAG, @@ -41,7 +37,7 @@ from leap.keymanager.documents import ( KEY_ENCR_USED_KEY, KEY_SIGN_USED_KEY, ) -from leap.keymanager.validation import ValidationLevels +from leap.bitmask.keymanager.validation import ValidationLevels from common import ( KeyManagerWithSoledadTestCase, diff --git a/tests/keymanager/test_openpgp.py b/tests/integration/keymanager/test_openpgp.py index 1f78ad4..9af35a1 100644 --- a/tests/keymanager/test_openpgp.py +++ b/tests/integration/keymanager/test_openpgp.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # test_keymanager.py -# Copyright (C) 2014 LEAP +# Copyright (C) 2014-2016 LEAP # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,26 +14,22 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. - - """ Tests for the OpenPGP support on Key Manager. """ - - from datetime import datetime from mock import Mock from twisted.internet.defer import inlineCallbacks, gatherResults, succeed -from leap.keymanager import ( +from leap.bitmask.keymanager import ( KeyNotFound, openpgp, ) -from leap.keymanager.documents import ( +from leap.bitmask.keymanager.documents import ( TYPE_FINGERPRINT_PRIVATE_INDEX, TYPE_ADDRESS_PRIVATE_INDEX, ) -from leap.keymanager.keys import OpenPGPKey +from leap.bitmask.keymanager.keys import OpenPGPKey from common import ( KeyManagerWithSoledadTestCase, diff --git a/tests/keymanager/test_validation.py b/tests/integration/keymanager/test_validation.py index 4aa0795..8a41137 100644 --- a/tests/keymanager/test_validation.py +++ b/tests/integration/keymanager/test_validation.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# __init__.py -# Copyright (C) 2014 LEAP +# test_validation.py +# Copyright (C) 2014-2016 LEAP # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,13 +17,12 @@ """ Tests for the Validation Levels """ - import unittest from datetime import datetime from twisted.internet.defer import inlineCallbacks -from leap.keymanager.errors import KeyNotValidUpgrade -from leap.keymanager.validation import ValidationLevels +from leap.bitmask.keymanager.errors import KeyNotValidUpgrade +from leap.bitmask.keymanager.validation import ValidationLevels from common import ( KeyManagerWithSoledadTestCase, diff --git a/src/leap/bitmask/mail/adaptors/tests/test_models.py b/tests/integration/mail/adaptors/test_models.py index b82cfad..2bd1778 100644 --- a/src/leap/bitmask/mail/adaptors/tests/test_models.py +++ b/tests/integration/mail/adaptors/test_models.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # test_models.py -# Copyright (C) 2014 LEAP +# Copyright (C) 2014-2016 LEAP # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ Tests for the leap.mail.adaptors.models module. """ from twisted.trial import unittest -from leap.mail.adaptors import models +from leap.bitmask.mail.adaptors import models class SerializableModelsTestCase(unittest.TestCase): diff --git a/src/leap/bitmask/mail/adaptors/tests/test_soledad_adaptor.py b/tests/integration/mail/adaptors/test_soledad_adaptor.py index 73eaf16..8d2ebb5 100644 --- a/src/leap/bitmask/mail/adaptors/tests/test_soledad_adaptor.py +++ b/tests/integration/mail/adaptors/test_soledad_adaptor.py @@ -15,18 +15,18 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. """ -Tests for the Soledad Adaptor module - leap.mail.adaptors.soledad +Tests for the Soledad Adaptor module - leap.bitmask.mail.adaptors.soledad """ import os from functools import partial from twisted.internet import defer -from leap.mail.adaptors import models -from leap.mail.adaptors.soledad import SoledadDocumentWrapper -from leap.mail.adaptors.soledad import SoledadIndexMixin -from leap.mail.adaptors.soledad import SoledadMailAdaptor -from leap.mail.testing.common import SoledadTestMixin +from leap.bitmask.mail.adaptors import models +from leap.bitmask.mail.adaptors.soledad import SoledadDocumentWrapper +from leap.bitmask.mail.adaptors.soledad import SoledadIndexMixin +from leap.bitmask.mail.adaptors.soledad import SoledadMailAdaptor +from leap.bitmask.mail.testing.common import SoledadTestMixin from email.MIMEMultipart import MIMEMultipart from email.mime.text import MIMEText @@ -35,6 +35,8 @@ from email.mime.text import MIMEText # import logging # logging.basicConfig(level=logging.DEBUG) +HERE = os.path.split(os.path.abspath(__file__))[0] + class CounterWrapper(SoledadDocumentWrapper): class model(models.SerializableModel): @@ -275,8 +277,6 @@ class SoledadDocWrapperTestCase(SoledadTestMixin): d.addCallback(assert_actor_list_is_expected) return d -HERE = os.path.split(os.path.abspath(__file__))[0] - class MessageClass(object): def __init__(self, wrapper, uid): @@ -310,7 +310,7 @@ class SoledadMailAdaptorTestCase(SoledadTestMixin): def test_get_msg_from_string(self): adaptor = self.get_adaptor() - with open(os.path.join(HERE, "rfc822.message")) as f: + with open(os.path.join(HERE, '..', 'rfc822.message')) as f: raw = f.read() msg = adaptor.get_msg_from_string(MessageClass, raw) @@ -389,7 +389,7 @@ class SoledadMailAdaptorTestCase(SoledadTestMixin): def test_create_msg(self): adaptor = self.get_adaptor() - with open(os.path.join(HERE, "rfc822.message")) as f: + with open(os.path.join(HERE, '..', 'rfc822.message')) as f: raw = f.read() msg = adaptor.get_msg_from_string(MessageClass, raw) @@ -407,7 +407,7 @@ class SoledadMailAdaptorTestCase(SoledadTestMixin): def test_update_msg(self): adaptor = self.get_adaptor() - with open(os.path.join(HERE, "rfc822.message")) as f: + with open(os.path.join(HERE, '..', 'rfc822.message')) as f: raw = f.read() def assert_msg_has_doc_id(ignored, msg): diff --git a/src/leap/bitmask/mail/imap/tests/.gitignore b/tests/integration/mail/imap/.gitignore index 60baa9c..60baa9c 100644 --- a/src/leap/bitmask/mail/imap/tests/.gitignore +++ b/tests/integration/mail/imap/.gitignore diff --git a/src/leap/bitmask/mail/imap/tests/getmail b/tests/integration/mail/imap/getmail index dd3fa0b..dd3fa0b 100755 --- a/src/leap/bitmask/mail/imap/tests/getmail +++ b/tests/integration/mail/imap/getmail diff --git a/src/leap/bitmask/mail/imap/tests/imapclient.py b/tests/integration/mail/imap/imapclient.py index c353cee..c353cee 100755 --- a/src/leap/bitmask/mail/imap/tests/imapclient.py +++ b/tests/integration/mail/imap/imapclient.py diff --git a/src/leap/bitmask/mail/imap/tests/regressions_mime_struct b/tests/integration/mail/imap/regressions_mime_struct index 0332664..0332664 100755 --- a/src/leap/bitmask/mail/imap/tests/regressions_mime_struct +++ b/tests/integration/mail/imap/regressions_mime_struct diff --git a/src/leap/bitmask/mail/adaptors/tests/rfc822.message b/tests/integration/mail/imap/rfc822.message index b19cc28..b19cc28 120000 --- a/src/leap/bitmask/mail/adaptors/tests/rfc822.message +++ b/tests/integration/mail/imap/rfc822.message diff --git a/src/leap/bitmask/mail/imap/tests/rfc822.multi-minimal.message b/tests/integration/mail/imap/rfc822.multi-minimal.message index e0aa678..e0aa678 120000 --- a/src/leap/bitmask/mail/imap/tests/rfc822.multi-minimal.message +++ b/tests/integration/mail/imap/rfc822.multi-minimal.message diff --git a/src/leap/bitmask/mail/imap/tests/rfc822.multi-nested.message b/tests/integration/mail/imap/rfc822.multi-nested.message index 306d0de..306d0de 120000 --- a/src/leap/bitmask/mail/imap/tests/rfc822.multi-nested.message +++ b/tests/integration/mail/imap/rfc822.multi-nested.message diff --git a/src/leap/bitmask/mail/imap/tests/rfc822.multi-signed.message b/tests/integration/mail/imap/rfc822.multi-signed.message index 4172244..4172244 120000 --- a/src/leap/bitmask/mail/imap/tests/rfc822.multi-signed.message +++ b/tests/integration/mail/imap/rfc822.multi-signed.message diff --git a/src/leap/bitmask/mail/imap/tests/rfc822.multi.message b/tests/integration/mail/imap/rfc822.multi.message index 62057d2..62057d2 120000 --- a/src/leap/bitmask/mail/imap/tests/rfc822.multi.message +++ b/tests/integration/mail/imap/rfc822.multi.message diff --git a/src/leap/bitmask/mail/imap/tests/rfc822.plain.message b/tests/integration/mail/imap/rfc822.plain.message index 5bab0e8..5bab0e8 120000 --- a/src/leap/bitmask/mail/imap/tests/rfc822.plain.message +++ b/tests/integration/mail/imap/rfc822.plain.message diff --git a/src/leap/bitmask/mail/imap/tests/stress_tests_imap.zsh b/tests/integration/mail/imap/stress_tests_imap.zsh index 544faca..544faca 100755 --- a/src/leap/bitmask/mail/imap/tests/stress_tests_imap.zsh +++ b/tests/integration/mail/imap/stress_tests_imap.zsh diff --git a/src/leap/bitmask/mail/imap/tests/test_imap.py b/tests/integration/mail/imap/test_imap.py index 9cca17f..8d34a49 100644 --- a/src/leap/bitmask/mail/imap/tests/test_imap.py +++ b/tests/integration/mail/imap/test_imap.py @@ -37,14 +37,16 @@ from twisted.python import failure from twisted import cred -from leap.mail.imap.mailbox import IMAPMailbox -from leap.mail.imap.messages import CaseInsensitiveDict -from leap.mail.testing.imap import IMAP4HelperMixin +from leap.bitmask.mail.imap.mailbox import IMAPMailbox +from leap.bitmask.mail.imap.messages import CaseInsensitiveDict +from leap.bitmask.mail.testing.imap import IMAP4HelperMixin TEST_USER = "testuser@leap.se" TEST_PASSWD = "1234" +HERE = os.path.split(os.path.abspath(__file__))[0] + def strip(f): return lambda result, f=f: f() @@ -85,8 +87,8 @@ class LEAPIMAP4ServerTestCase(IMAP4HelperMixin): Tests for the generic behavior of the LEAPIMAP4Server which, right now, it's just implemented in this test file as LEAPIMAPServer. We will move the implementation, together with - authentication bits, to leap.mail.imap.server so it can be instantiated - from the tac file. + authentication bits, to leap.bitmask.mail.imap.server so it can be + instantiated from the tac file. Right now this TestCase tries to mimmick as close as possible the organization from the twisted.mail.imap tests so we can achieve @@ -816,7 +818,7 @@ class LEAPIMAP4ServerTestCase(IMAP4HelperMixin): """ Test appending a full message to the mailbox """ - infile = util.sibpath(__file__, 'rfc822.message') + infile = os.path.join(HERE, '..', 'rfc822.message') message = open(infile) acc = self.server.theAccount mailbox_name = "appendmbox/subthing" @@ -892,7 +894,7 @@ class LEAPIMAP4ServerTestCase(IMAP4HelperMixin): Test partially appending a message to the mailbox """ # TODO this test sometimes will fail because of the notify_just_mdoc - infile = util.sibpath(__file__, 'rfc822.message') + infile = os.path.join(HERE, '..', 'rfc822.message') acc = self.server.theAccount diff --git a/src/leap/bitmask/mail/imap/tests/walktree.py b/tests/integration/mail/imap/walktree.py index f259a55..5a4ed7e 100644 --- a/src/leap/bitmask/mail/imap/tests/walktree.py +++ b/tests/integration/mail/imap/walktree.py @@ -22,7 +22,7 @@ import sys import pprint from email import parser -from leap.mail import walk as W +from leap.bitmask.mail import walk as W DEBUG = os.environ.get("BITMASK_MAIL_DEBUG") diff --git a/src/leap/bitmask/mail/incoming/tests/rfc822.multi-encrypt-signed.message b/tests/integration/mail/incoming/rfc822.multi-encrypt-signed.message index 98304f2..98304f2 100644 --- a/src/leap/bitmask/mail/incoming/tests/rfc822.multi-encrypt-signed.message +++ b/tests/integration/mail/incoming/rfc822.multi-encrypt-signed.message diff --git a/src/leap/bitmask/mail/incoming/tests/test_incoming_mail.py b/tests/integration/mail/incoming/test_incoming_mail.py index 29422ec..b8d69f1 100644 --- a/src/leap/bitmask/mail/incoming/tests/test_incoming_mail.py +++ b/tests/integration/mail/incoming/test_incoming_mail.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # test_incoming_mail.py -# Copyright (C) 2015 LEAP +# Copyright (C) 2015-2016 LEAP # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,13 +15,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. """ -Test case for leap.mail.incoming.service +Test case for leap.bitmask.mail.incoming.service @authors: Ruben Pollan, <meskio@sindominio.net> @license: GPLv3, see included LICENSE file """ - import json import os import tempfile @@ -35,17 +34,17 @@ from mock import Mock from twisted.internet import defer from twisted.python import log -from leap.keymanager.errors import KeyAddressMismatch -from leap.mail.adaptors import soledad_indexes as fields -from leap.mail.adaptors.soledad import cleanup_deferred_locks -from leap.mail.adaptors.soledad import SoledadMailAdaptor -from leap.mail.mail import MessageCollection -from leap.mail.mailbox_indexer import MailboxIndexer - -from leap.mail.incoming.service import IncomingMail -from leap.mail.rfc3156 import MultipartEncrypted, PGPEncrypted -from leap.mail.testing import KeyManagerWithSoledadTestCase -from leap.mail.testing import ADDRESS, ADDRESS_2 +from leap.bitmask.keymanager.errors import KeyAddressMismatch +from leap.bitmask.mail.adaptors import soledad_indexes as fields +from leap.bitmask.mail.adaptors.soledad import cleanup_deferred_locks +from leap.bitmask.mail.adaptors.soledad import SoledadMailAdaptor +from leap.bitmask.mail.mail import MessageCollection +from leap.bitmask.mail.mailbox_indexer import MailboxIndexer + +from leap.bitmask.mail.incoming.service import IncomingMail +from leap.bitmask.mail.rfc3156 import MultipartEncrypted, PGPEncrypted +from leap.bitmask.mail.testing import KeyManagerWithSoledadTestCase +from leap.bitmask.mail.testing import ADDRESS, ADDRESS_2 from leap.soledad.common.document import SoledadDocument from leap.soledad.common.crypto import ( EncryptionSchemes, diff --git a/src/leap/bitmask/mail/outgoing/tests/test_outgoing.py b/tests/integration/mail/outgoing/test_outgoing.py index dd053c1..1684a54 100644 --- a/src/leap/bitmask/mail/outgoing/tests/test_outgoing.py +++ b/tests/integration/mail/outgoing/test_outgoing.py @@ -30,12 +30,12 @@ from twisted.python import log from mock import Mock -from leap.mail.rfc3156 import RFC3156CompliantGenerator -from leap.mail.outgoing.service import OutgoingMail -from leap.mail.testing import ADDRESS, ADDRESS_2, PUBLIC_KEY_2 -from leap.mail.testing import KeyManagerWithSoledadTestCase -from leap.mail.testing.smtp import getSMTPFactory -from leap.keymanager import errors +from leap.bitmask.mail.rfc3156 import RFC3156CompliantGenerator +from leap.bitmask.mail.outgoing.service import OutgoingMail +from leap.bitmask.mail.testing import ADDRESS, ADDRESS_2, PUBLIC_KEY_2 +from leap.bitmask.mail.testing import KeyManagerWithSoledadTestCase +from leap.bitmask.mail.testing.smtp import getSMTPFactory +from leap.bitmask.keymanager import errors BEGIN_PUBLIC_KEY = "-----BEGIN PGP PUBLIC KEY BLOCK-----" @@ -214,7 +214,7 @@ class TestOutgoingMail(KeyManagerWithSoledadTestCase): dest = User(unknown_address, 'gateway.leap.se', self.proto, ADDRESS_2) d = self.outgoing_mail._maybe_encrypt_and_sign( - raw, dest, fetch_remote=False) + raw, dest, fetch_remote=False) d.addCallback(lambda (message, _): self._check_headers(message, lines[:4])) d.addCallback(self._check_key_attachment) diff --git a/src/leap/bitmask/mail/tests/rfc822.bounce.message b/tests/integration/mail/rfc822.bounce.message index 7a51ac0..7a51ac0 100644 --- a/src/leap/bitmask/mail/tests/rfc822.bounce.message +++ b/tests/integration/mail/rfc822.bounce.message diff --git a/src/leap/bitmask/mail/tests/rfc822.message b/tests/integration/mail/rfc822.message index ee97ab9..ee97ab9 100644 --- a/src/leap/bitmask/mail/tests/rfc822.message +++ b/tests/integration/mail/rfc822.message diff --git a/src/leap/bitmask/mail/tests/rfc822.multi-minimal.message b/tests/integration/mail/rfc822.multi-minimal.message index 582297c..582297c 100644 --- a/src/leap/bitmask/mail/tests/rfc822.multi-minimal.message +++ b/tests/integration/mail/rfc822.multi-minimal.message diff --git a/src/leap/bitmask/mail/tests/rfc822.multi-nested.message b/tests/integration/mail/rfc822.multi-nested.message index 694bef5..694bef5 100644 --- a/src/leap/bitmask/mail/tests/rfc822.multi-nested.message +++ b/tests/integration/mail/rfc822.multi-nested.message diff --git a/src/leap/bitmask/mail/tests/rfc822.multi-signed.message b/tests/integration/mail/rfc822.multi-signed.message index 9907c2d..9907c2d 100644 --- a/src/leap/bitmask/mail/tests/rfc822.multi-signed.message +++ b/tests/integration/mail/rfc822.multi-signed.message diff --git a/src/leap/bitmask/mail/tests/rfc822.multi.message b/tests/integration/mail/rfc822.multi.message index 30f74e5..30f74e5 100644 --- a/src/leap/bitmask/mail/tests/rfc822.multi.message +++ b/tests/integration/mail/rfc822.multi.message diff --git a/src/leap/bitmask/mail/tests/rfc822.plain.message b/tests/integration/mail/rfc822.plain.message index fc627c3..fc627c3 100644 --- a/src/leap/bitmask/mail/tests/rfc822.plain.message +++ b/tests/integration/mail/rfc822.plain.message diff --git a/src/leap/bitmask/mail/smtp/tests/185CA770.key b/tests/integration/mail/smtp/185CA770.key index 587b416..587b416 100644 --- a/src/leap/bitmask/mail/smtp/tests/185CA770.key +++ b/tests/integration/mail/smtp/185CA770.key diff --git a/src/leap/bitmask/mail/smtp/tests/185CA770.pub b/tests/integration/mail/smtp/185CA770.pub index 38af19f..38af19f 100644 --- a/src/leap/bitmask/mail/smtp/tests/185CA770.pub +++ b/tests/integration/mail/smtp/185CA770.pub diff --git a/src/leap/bitmask/mail/smtp/tests/cert/server.crt b/tests/integration/mail/smtp/cert/server.crt index a27391c..a27391c 100644 --- a/src/leap/bitmask/mail/smtp/tests/cert/server.crt +++ b/tests/integration/mail/smtp/cert/server.crt diff --git a/src/leap/bitmask/mail/smtp/tests/cert/server.key b/tests/integration/mail/smtp/cert/server.key index 197a449..197a449 100644 --- a/src/leap/bitmask/mail/smtp/tests/cert/server.key +++ b/tests/integration/mail/smtp/cert/server.key diff --git a/src/leap/bitmask/mail/smtp/tests/mail.txt b/tests/integration/mail/smtp/mail.txt index 9542047..9542047 100644 --- a/src/leap/bitmask/mail/smtp/tests/mail.txt +++ b/tests/integration/mail/smtp/mail.txt diff --git a/src/leap/bitmask/mail/smtp/tests/test_gateway.py b/tests/integration/mail/smtp/test_gateway.py index 9d88afb..e286be9 100644 --- a/src/leap/bitmask/mail/smtp/tests/test_gateway.py +++ b/tests/integration/mail/smtp/test_gateway.py @@ -28,10 +28,10 @@ from twisted.test import proto_helpers from mock import Mock -from leap.keymanager import openpgp, errors -from leap.mail.testing import KeyManagerWithSoledadTestCase -from leap.mail.testing import ADDRESS, ADDRESS_2 -from leap.mail.testing.smtp import getSMTPFactory, TEST_USER +from leap.bitmask.keymanager import openpgp, errors +from leap.bitmask.mail.testing import KeyManagerWithSoledadTestCase +from leap.bitmask.mail.testing import ADDRESS, ADDRESS_2 +from leap.bitmask.mail.testing.smtp import getSMTPFactory, TEST_USER # some regexps diff --git a/src/leap/bitmask/mail/tests/test_mail.py b/tests/integration/mail/test_mail.py index f9cded2..637340d 100644 --- a/src/leap/bitmask/mail/tests/test_mail.py +++ b/tests/integration/mail/test_mail.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # test_mail.py -# Copyright (C) 2014 LEAP +# Copyright (C) 2014-2016 LEAP # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,10 +25,10 @@ from functools import partial from email.parser import Parser from email.Utils import formatdate -from leap.mail.adaptors.soledad import SoledadMailAdaptor -from leap.mail.mail import MessageCollection, Account, _unpack_headers -from leap.mail.mailbox_indexer import MailboxIndexer -from leap.mail.testing.common import SoledadTestMixin +from leap.bitmask.mail.adaptors.soledad import SoledadMailAdaptor +from leap.bitmask.mail.mail import MessageCollection, Account, _unpack_headers +from leap.bitmask.mail.mailbox_indexer import MailboxIndexer +from leap.bitmask.mail.testing.common import SoledadTestMixin HERE = os.path.split(os.path.abspath(__file__))[0] diff --git a/src/leap/bitmask/mail/tests/test_mailbox_indexer.py b/tests/integration/mail/test_mailbox_indexer.py index 5c1891d..a3388d1 100644 --- a/src/leap/bitmask/mail/tests/test_mailbox_indexer.py +++ b/tests/integration/mail/test_mailbox_indexer.py @@ -20,8 +20,8 @@ Tests for the mailbox_indexer module. import uuid from functools import partial -from leap.mail import mailbox_indexer as mi -from leap.mail.testing.common import SoledadTestMixin +from leap.bitmask.mail import mailbox_indexer as mi +from leap.bitmask.mail.testing.common import SoledadTestMixin hash_test0 = '590c9f8430c7435807df8ba9a476e3f1295d46ef210f6efae2043a4c085a569e' hash_test1 = '1b4f0e9851971998e732078544c96b36c3d01cedf7caa332359d6f1d83567014' diff --git a/src/leap/bitmask/mail/tests/test_walk.py b/tests/integration/mail/test_walk.py index 826ec10..9eac5e5 100644 --- a/src/leap/bitmask/mail/tests/test_walk.py +++ b/tests/integration/mail/test_walk.py @@ -4,7 +4,7 @@ Tests for leap.mail.walk module import os.path from email.parser import Parser -from leap.mail import walk +from leap.bitmask.mail import walk CORPUS = { 'simple': 'rfc822.message', diff --git a/tests/unit/readme.txt b/tests/unit/readme.txt new file mode 100644 index 0000000..bc62a32 --- /dev/null +++ b/tests/unit/readme.txt @@ -0,0 +1,4 @@ +move here your tests if you are certain that they: +a) are unittest +b) do not use network or in-disk sqlite store +c) are fast |