diff options
-rwxr-xr-x | service/go | 28 | ||||
-rw-r--r-- | service/pixelated/adapter/services/mail_service.py | 2 | ||||
-rw-r--r-- | service/pixelated/adapter/services/mailboxes.py | 12 | ||||
-rw-r--r-- | service/pixelated/adapter/soledad/soledad_writer_mixin.py | 24 | ||||
-rw-r--r-- | service/pixelated/bitmask_libraries/smtp.py | 1 | ||||
-rw-r--r-- | service/setup.cfg | 2 | ||||
-rw-r--r-- | service/setup.py | 20 | ||||
-rw-r--r-- | service/test/support/integration/app_test_client.py | 2 |
8 files changed, 29 insertions, 62 deletions
@@ -1,9 +1,29 @@ #!/bin/bash -if [ "$1" == 'test' ] -then - nosetests --nocapture test/unit - nosetests --nocapture test/integration +function setuppy { + pip install -r requirements.txt + pip install -r test_requirements.txt + python setup.py develop +} + +function setupjs { + cd ../web-ui + LC_ALL=en_US.UTF-8 ./go build + cd - +} + +if [ "$1" == 'test' ]; then + nosetests "${@:2}" test/unit + nosetests "${@:2}" test/integration +elif [ "$1" == 'setuppy' ]; then + setuppy +elif [ "$1" == 'setupjs' ]; then + setupjs +elif [ "$1" == 'setup' ]; then + setupjs + setuppy +elif [ "$1" == 'start' ]; then + /usr/bin/env pixelated-user-agent "${@:2}" else python setup.py $* fi diff --git a/service/pixelated/adapter/services/mail_service.py b/service/pixelated/adapter/services/mail_service.py index b828222b..3b70890b 100644 --- a/service/pixelated/adapter/services/mail_service.py +++ b/service/pixelated/adapter/services/mail_service.py @@ -39,7 +39,7 @@ class MailService: return mail def mail(self, mail_id): - return self.mailboxes.mail(mail_id) + return self.querier.mail(mail_id) def mail_exists(self, mail_id): return not(not(self.querier.get_header_by_chash(mail_id))) diff --git a/service/pixelated/adapter/services/mailboxes.py b/service/pixelated/adapter/services/mailboxes.py index 56304dd6..51d4add9 100644 --- a/service/pixelated/adapter/services/mailboxes.py +++ b/service/pixelated/adapter/services/mailboxes.py @@ -47,13 +47,6 @@ class Mailboxes(): def mailboxes(self): return [self._create_or_get(leap_mailbox_name) for leap_mailbox_name in self.account.mailboxes] - def mails_by_tag(self, query_tags): - mails = [] - for mailbox in self.mailboxes(): - mails.extend(mailbox.mails_by_tags(query_tags)) - - return mails - def move_to_trash(self, mail_id): mail = self.querier.mail(mail_id) mail.remove_all_tags() @@ -62,7 +55,4 @@ class Mailboxes(): return mail def mail(self, mail_id): - for mailbox in self.mailboxes(): - mail = mailbox.mail(mail_id) - if mail: - return mail + return self.querier.mail(mail_id) diff --git a/service/pixelated/adapter/soledad/soledad_writer_mixin.py b/service/pixelated/adapter/soledad/soledad_writer_mixin.py index 30ca57bd..869f7c07 100644 --- a/service/pixelated/adapter/soledad/soledad_writer_mixin.py +++ b/service/pixelated/adapter/soledad/soledad_writer_mixin.py @@ -30,40 +30,20 @@ class SoledadWriterMixin(SoledadDbFacadeMixin, object): def save_mail(self, mail): self.put_doc(mail.fdoc) - self._update_index([mail.fdoc]) def create_mail(self, mail, mailbox_name): mbox = self.get_mbox(mailbox_name)[0] uid = mbox.content['lastuid'] + 1 - new_docs = [self.create_doc(doc) for doc in mail.get_for_save(next_uid=uid, mailbox=mailbox_name)] - fdoc, hdoc, cdocs = new_docs[0], new_docs[1], new_docs[2:len(new_docs)] - bdoc_index = None - for i, val in enumerate(cdocs): - if val.content['phash'] == hdoc.content['body']: - bdoc_index = i - bdoc = cdocs.pop(bdoc_index) + [self.create_doc(doc) for doc in mail.get_for_save(next_uid=uid, mailbox=mailbox_name)] mbox.content['lastuid'] = uid self.put_doc(mbox) - self._update_index(new_docs) - return self.mail(mail.ident) # PixelatedMail.from_soledad(fdoc, hdoc, bdoc, parts=None, soledad_querier=self) + return self.mail(mail.ident) def remove_mail(self, mail): # FIX-ME: Must go through all the part_map phash to delete all the cdocs self.delete_doc(mail.fdoc) self.delete_doc(mail.hdoc) self.delete_doc(mail.bdoc) - - def _update_index(self, docs): - db = self.soledad._db - - indexed_fields = db._get_indexed_fields() - if indexed_fields: - # It is expected that len(indexed_fields) is shorter than - # len(raw_doc) - getters = [(field, db._parse_index_definition(field)) - for field in indexed_fields] - for doc in docs: - db._update_indexes(doc.doc_id, doc.content, getters, db._db_handle) diff --git a/service/pixelated/bitmask_libraries/smtp.py b/service/pixelated/bitmask_libraries/smtp.py index 439da190..6bbe0051 100644 --- a/service/pixelated/bitmask_libraries/smtp.py +++ b/service/pixelated/bitmask_libraries/smtp.py @@ -30,7 +30,6 @@ class LeapSmtp(object): self._hostname, self._port = self._discover_smtp_server() self._smtp_port = None self._smtp_service = None - print('SMTP server running on port %d' % self.TWISTED_PORT) def smtp_info(self): return ('localhost', self.TWISTED_PORT) diff --git a/service/setup.cfg b/service/setup.cfg deleted file mode 100644 index dd36c937..00000000 --- a/service/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[nosetests] -nocapture=1 diff --git a/service/setup.py b/service/setup.py index 0cbac974..4d83910f 100644 --- a/service/setup.py +++ b/service/setup.py @@ -17,9 +17,6 @@ import sys -if 'develop' in sys.argv: - sys.argv.append('--always-unzip') - # next line is a fix to this error that occurs with nose > 1.1.2 and the debian # python: http://bugs.python.org/issue15881#msg170215 import multiprocessing @@ -88,23 +85,6 @@ setup(name='pixelated-user-agent', 'pixelated.controllers' ], test_suite='nose.collector', - # install_requires=[ - # 'cryptography==0.6.1', - # 'pyasn1==0.1.7', - # 'gnupg==1.4.0', - # 'Twisted==14.0.2', - # 'service-identity==14.0.0', - # 'klein==0.2.3', - # 'requests==2.5.0', - # 'srp==1.0.5', - # 'dirspec==13.10', - # 'u1db==13.09', - # 'leap.keymanager==0.3.8', - # 'leap.soledad.common==0.6.0-26-g509f76c'. - # 'leap.soledad.client==0.6.0-26-g509f76c', - # 'leap.mail==0.3.9-1-gc1f9c92', - # 'whoosh==2.6.0' - # ], entry_points={ 'console_scripts': [ 'pixelated-user-agent = pixelated.runserver:setup' diff --git a/service/test/support/integration/app_test_client.py b/service/test/support/integration/app_test_client.py index 4d444f8d..32d70a66 100644 --- a/service/test/support/integration/app_test_client.py +++ b/service/test/support/integration/app_test_client.py @@ -38,7 +38,7 @@ from test.support.integration.model import MailBuilder class AppTestClient: - def __init__(self, soledad_test_folder='soledad-test'): + def __init__(self, soledad_test_folder='soledad-test/test'): self.soledad = initialize_soledad(tempdir=soledad_test_folder) self.mail_address = "test@pixelated.org" |