summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--debian/control4
-rw-r--r--debian/pixelated-user-agent.links3
-rwxr-xr-xdebian/rules2
-rwxr-xr-xprovisioning/modules/pixelated/files/activate_custom_node_modules.sh3
-rw-r--r--service/pixelated/adapter/services/mail_service.py1
-rw-r--r--service/pixelated/maintenance.py5
-rw-r--r--service/pixelated/resources/mails_resource.py1
-rw-r--r--service/requirements.txt10
-rw-r--r--service/setup.py1
-rw-r--r--service/test/integration/test_drafts.py3
-rw-r--r--service/test/integration/test_soledad_querier.py90
-rw-r--r--service/test/perf/contacts/test_Contacts.py17
-rw-r--r--service/test/unit/adapter/mailstore/test_leap_mailstore.py1
14 files changed, 40 insertions, 103 deletions
diff --git a/README.md b/README.md
index edf926dd..7138b19e 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
Pixelated User Agent
====================
-[![Build Status](https://snap-ci.com/pixelated-project/pixelated-user-agent/branch/master/build_image)](https://snap-ci.com/pixelated-project/pixelated-user-agent/branch/master) [
+[![Build Status](https://snap-ci.com/pixelated/pixelated-user-agent/branch/master/build_image)](https://snap-ci.com/pixelated/pixelated-user-agent/branch/master) [
![Coverage Status](https://coveralls.io/repos/pixelated-project/pixelated-user-agent/badge.svg?branch=master)](https://coveralls.io/r/pixelated-project/pixelated-user-agent?branch=master)
The Pixelated User Agent is the mail client of the Pixelated ecosystem. It is composed of two parts, a web interface written in JavaScript ([FlightJS](https://flightjs.github.io/)) and a Python API that interacts with a LEAP Provider, the e-mail platform that Pixelated is built on.
diff --git a/debian/control b/debian/control
index 35d4af94..b05e7d67 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: pixelated-user-agent
Maintainer: Pixelated Team <pixelated-team@thoughtworks.com>
Section: python
Priority: optional
-Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 7.4.3), ruby-compass, nodejs
+Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 7.4.3), ruby-compass, nodejs, nodejs-legacy, build-essential, libffi-dev, python-dev, pixpybuild
Standards-Version: 3.9.1
Homepage: http://pixelated-project.org
Vcs-Git: https://github.com/pixelated-project/pixelated-user-agent.git
@@ -11,7 +11,7 @@ X-Python-Version: >= 2.7
Package: pixelated-user-agent
Architecture: all
-Depends: python (>= 2.7), python (<< 2.8), leap-keymanager, soledad-common, soledad-client, leap-mail, leap-auth, python-dirspec, python-u1db, python-whoosh (>=2.5.7), python-sqlcipher, python-twisted-web (>= 12.3.0), python-pyasn1, python-gnupg, python-requests (>= 2.0.0), python-twisted (>= 12.3.0)
+Depends: python (>= 2.7), python (<< 2.8), libffi5, python-gnupg
Description: API to serve the pixelated front-end requests
Pixelated User Agent Service
============================
diff --git a/debian/pixelated-user-agent.links b/debian/pixelated-user-agent.links
new file mode 100644
index 00000000..d5bfa8ed
--- /dev/null
+++ b/debian/pixelated-user-agent.links
@@ -0,0 +1,3 @@
+/usr/share/python/pixelated-user-agent/bin/pixelated-user-agent /usr/bin/pixelated-user-agent
+/usr/share/python/pixelated-user-agent/bin/pixelated-maintenance /usr/bin/pixelated-maintenance
+
diff --git a/debian/rules b/debian/rules
index 742f40f1..0e82b529 100755
--- a/debian/rules
+++ b/debian/rules
@@ -19,7 +19,7 @@ include /usr/share/dpkg/default.mk
# main packaging script based on dh7 syntax
%:
- dh $@ --sourcedirectory=service
+ dh $@ --buildsystem pixpybuild --sourcedirectory=service
# debmake generated override targets
# This is example for Cmake (See http://bugs.debian.org/641051 )
diff --git a/provisioning/modules/pixelated/files/activate_custom_node_modules.sh b/provisioning/modules/pixelated/files/activate_custom_node_modules.sh
index f46b67e1..5ad419e3 100755
--- a/provisioning/modules/pixelated/files/activate_custom_node_modules.sh
+++ b/provisioning/modules/pixelated/files/activate_custom_node_modules.sh
@@ -27,6 +27,9 @@ fi
source /home/vagrant/user-agent-venv/bin/activate
+pip install --upgrade pip
+pip install --upgrade setuptools
+
cd /vagrant/service
echo "running python setup"
./go setuppy > /dev/null
diff --git a/service/pixelated/adapter/services/mail_service.py b/service/pixelated/adapter/services/mail_service.py
index 6ae34472..4623a5eb 100644
--- a/service/pixelated/adapter/services/mail_service.py
+++ b/service/pixelated/adapter/services/mail_service.py
@@ -117,7 +117,6 @@ class MailService(object):
@defer.inlineCallbacks
def delete_mail(self, mail_id):
mail = yield self.mail(mail_id)
- print 'go mail %s' % mail
if mail.mailbox_name.upper() == u'TRASH':
yield self.mail_store.delete_mail(mail_id)
else:
diff --git a/service/pixelated/maintenance.py b/service/pixelated/maintenance.py
index 63a0fa0e..ae320049 100644
--- a/service/pixelated/maintenance.py
+++ b/service/pixelated/maintenance.py
@@ -98,15 +98,16 @@ def add_command_callback(args, prepareDeferred, finalizeDeferred):
return finalizeDeferred
+@defer.inlineCallbacks
def delete_all_mails(args):
leap_session, soledad = args
- generation, docs = soledad.get_all_docs()
+ generation, docs = yield soledad.get_all_docs()
for doc in docs:
if doc.content.get('type', None) in ['head', 'cnt', 'flags']:
soledad.delete_doc(doc)
- return args
+ defer.returnValue(args)
def is_keep_file(mail):
diff --git a/service/pixelated/resources/mails_resource.py b/service/pixelated/resources/mails_resource.py
index 9658bd82..e18fe2c3 100644
--- a/service/pixelated/resources/mails_resource.py
+++ b/service/pixelated/resources/mails_resource.py
@@ -168,7 +168,6 @@ class MailsResource(Resource):
defer_response(self._draft_service.update_draft(draft_id, _mail))
deferred_check.addCallback(return422otherwise)
else:
- print '\nCreating draft\n'
defer_response(self._draft_service.create_draft(_mail))
return server.NOT_DONE_YET
diff --git a/service/requirements.txt b/service/requirements.txt
new file mode 100644
index 00000000..e4c2dce3
--- /dev/null
+++ b/service/requirements.txt
@@ -0,0 +1,10 @@
+--allow-external u1db --allow-unverified u1db
+--allow-external dirspec --allow-unverified dirspec
+-e 'git+https://github.com/pixelated-project/leap_pycommon.git@develop#egg=leap.common'
+-e 'git+https://github.com/pixelated-project/leap_auth.git#egg=leap.auth'
+-e 'git+https://github.com/pixelated-project/soledad.git@develop#egg=leap.soledad.common&subdirectory=common/'
+-e 'git+https://github.com/pixelated-project/soledad.git@develop#egg=leap.soledad.client&subdirectory=client/'
+-e 'git+https://github.com/pixelated-project/soledad.git@develop#egg=leap.soledad.server&subdirectory=server/'
+-e 'git+https://github.com/pixelated-project/keymanager.git@develop#egg=leap.keymanager'
+-e 'git+https://github.com/pixelated-project/leap_mail.git@develop#egg=leap.mail'
+
diff --git a/service/setup.py b/service/setup.py
index cce41e18..60a009f9 100644
--- a/service/setup.py
+++ b/service/setup.py
@@ -35,6 +35,7 @@ setup(name='pixelated-user-agent',
'pixelated.adapter',
'pixelated.adapter.listeners',
'pixelated.adapter.model',
+ 'pixelated.adapter.mailstore',
'pixelated.adapter.search',
'pixelated.adapter.services',
'pixelated.adapter.soledad',
diff --git a/service/test/integration/test_drafts.py b/service/test/integration/test_drafts.py
index bc314c04..d0505d75 100644
--- a/service/test/integration/test_drafts.py
+++ b/service/test/integration/test_drafts.py
@@ -77,11 +77,8 @@ class DraftsTest(SoledadTestBase):
@defer.inlineCallbacks
def test_put_creates_a_draft_if_it_does_not_exist(self):
mail = MailBuilder().with_subject('A new draft').build_json()
- print '\nAdding mail\n'
yield self.put_mail(mail)[0]
- print '\nAdded mail\n'
mails = yield self.get_mails_by_tag('drafts')
- print '\ngot mails by tag\n'
self.assertEquals('A new draft', mails[0].subject)
diff --git a/service/test/integration/test_soledad_querier.py b/service/test/integration/test_soledad_querier.py
deleted file mode 100644
index 5a24968b..00000000
--- a/service/test/integration/test_soledad_querier.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#
-# Copyright (c) 2014 ThoughtWorks, Inc.
-#
-# Pixelated is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Pixelated is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
-
-import time
-from unittest import skip
-
-from test.support.integration import SoledadTestBase, MailBuilder
-from leap.mail.adaptors.soledad import MailboxWrapper
-from twisted.internet import defer
-
-
-@skip('No longer needed')
-class SoledadQuerierTest(SoledadTestBase):
-
- def setUp(self):
- self.maxDiff = None
- return SoledadTestBase.setUp(self)
-
- def _get_empty_mailbox(self):
- return MailboxWrapper()
-
- def _create_mailbox(self, mailbox_name):
- new_mailbox = self._get_empty_mailbox()
- new_mailbox.mbox = mailbox_name
- new_mailbox.created = int(time.time() * 10E2)
- return self.soledad.create_doc(new_mailbox.serialize())
-
- @defer.inlineCallbacks
- def _get_mailboxes_from_soledad(self, mailbox_name):
- defer.returnValue([m for m in (yield self.soledad.get_from_index('by-type', 'mbox')) if m.content['mbox'] == mailbox_name])
-
- @defer.inlineCallbacks
- def test_remove_dup_mailboxes_keeps_the_one_with_the_highest_last_uid(self):
- yield self.add_multiple_to_mailbox(3, 'INBOX') # by now we already have one inbox with 3 mails
- duplicated_mbox = yield self._create_mailbox('INBOX') # now we have a duplicate
-
- # make sure we have two and duplicated is one of them
- inboxes = yield self._get_mailboxes_from_soledad('INBOX')
- self.assertEqual(2, len(inboxes))
- self.assertIn(duplicated_mbox, inboxes)
-
- yield self.soledad_querier.remove_duplicates()
-
- # make sure we only have one, and it is not the duplicated one
- inboxes = yield self._get_mailboxes_from_soledad('INBOX')
- self.assertEqual(1, len(inboxes))
- self.assertNotIn(duplicated_mbox, inboxes)
-
- @defer.inlineCallbacks
- def test_all_mails_skips_incomplete_mails(self):
- # creating incomplete mail, we will only save the fdoc
- fdoc, hdoc, bdoc = MailBuilder().build_input_mail().get_for_save(1, 'INBOX')
- yield self.soledad.create_doc(fdoc)
-
- mails = yield self.soledad_querier.all_mails()
- self.assertEqual(0, len(mails)) # mail is incomplete since it only has fdoc
-
- # adding the hdoc still doesn't complete the mail
- yield self.soledad.create_doc(hdoc)
-
- mails = yield self.soledad_querier.all_mails()
- self.assertEqual(0, len(mails))
-
- # now the mail is complete
- yield self.soledad.create_doc(bdoc)
-
- mails = yield self.soledad_querier.all_mails()
- self.assertEqual(1, len(mails))
-
- @defer.inlineCallbacks
- def test_get_mails_by_chash(self):
- mails = yield self.add_multiple_to_mailbox(3, 'INBOX')
- chashes = [mail.ident for mail in mails]
-
- fetched_mails = yield self.soledad_querier.mails(chashes)
-
- self.assertEquals([m.as_dict() for m in fetched_mails], [m.as_dict() for m in mails])
diff --git a/service/test/perf/contacts/test_Contacts.py b/service/test/perf/contacts/test_Contacts.py
index 8bfb898d..967e9eb1 100644
--- a/service/test/perf/contacts/test_Contacts.py
+++ b/service/test/perf/contacts/test_Contacts.py
@@ -14,22 +14,37 @@
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
import unittest
+import logging
from funkload.FunkLoadTestCase import FunkLoadTestCase
from test.support.integration import AppTestClient
+from test.support.dispatcher.proxy import Proxy
+from crochet import setup, wait_for
+from leap.common.events.server import ensure_server
+setup()
+
+
+@wait_for(timeout=5.0)
+def start_app_test_client(client):
+ ensure_server()
+ return client.start_client()
class Contacts(FunkLoadTestCase):
def setUpBench(self):
+ logging.disable('INFO')
client = AppTestClient()
+ start_app_test_client(client)
+ client.listenTCP()
+ proxy = Proxy(proxy_port='8889', app_port='4567')
# setup data
client.add_multiple_to_mailbox(10, 'INBOX', to='to@inbox.com', cc='cc@inbox.com', bcc='bcc@inbox.com')
client.add_multiple_to_mailbox(10, 'TRASH', to='to@trash.com', cc='cc@trash.com', bcc='bcc@trash.com')
client.add_multiple_to_mailbox(10, 'DRAFTS', to='to@drafts.com', cc='cc@drafts.com', bcc='bcc@drafts.com')
- self.call_to_terminate = client.run_on_a_thread(logfile='results/app.log')
+ self.call_to_terminate = proxy.run_on_a_thread()
def tearDownBench(self):
self.call_to_terminate()
diff --git a/service/test/unit/adapter/mailstore/test_leap_mailstore.py b/service/test/unit/adapter/mailstore/test_leap_mailstore.py
index a28731e3..c2ad2d5a 100644
--- a/service/test/unit/adapter/mailstore/test_leap_mailstore.py
+++ b/service/test/unit/adapter/mailstore/test_leap_mailstore.py
@@ -300,7 +300,6 @@ class TestLeapMailStore(TestCase):
attachment = MIMEApplication('pretend to be binary attachment data')
attachment.add_header('Content-Disposition', 'attachment', filename='filename.txt')
input_mail.attach(attachment)
- print input_mail.as_string()
mocked_message = self._add_create_mail_mocks_to_soledad(input_mail)
store = LeapMailStore(self.soledad)