summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2015-01-28 11:24:23 -0300
committerVictor Shyba <victor.shyba@gmail.com>2015-01-28 11:24:23 -0300
commit9e24214a53a237e9d76e338536e3567aad70e730 (patch)
tree3f66c4e0fa616de43455924c56f98f2103cd5613
parentc49aa556e3ea0f152478f455ab2859d30acede7d (diff)
parentcf9982ed9469ba10ddb1064b68905b8411251ece (diff)
Merge branch 'wip_256'
-rw-r--r--service/test/support/integration/app_test_client.py16
-rw-r--r--service/test/support/integration/soledad_test_base.py3
2 files changed, 6 insertions, 13 deletions
diff --git a/service/test/support/integration/app_test_client.py b/service/test/support/integration/app_test_client.py
index fba9ba9c..d60d84dc 100644
--- a/service/test/support/integration/app_test_client.py
+++ b/service/test/support/integration/app_test_client.py
@@ -29,13 +29,12 @@ from pixelated.adapter.soledad.soledad_querier import SoledadQuerier
from pixelated.adapter.services.tag_service import TagService
from pixelated.config import App
from pixelated.resources.root_resource import RootResource
-import pixelated.runserver
from pixelated.adapter.model.mail import PixelatedMail
from pixelated.adapter.search import SearchEngine
from test.support.integration.model import MailBuilder
from test.support.test_helper import request_mock
from twisted.internet import reactor
-from twisted.internet.defer import Deferred
+from twisted.internet.defer import succeed
from twisted.web.resource import getChildForRequest
from twisted.web.server import Site
@@ -88,15 +87,10 @@ class AppTestClient:
if isinstance(result, basestring):
return get_str(result), request
- if request.finished:
- d = Deferred()
- d.addCallback(get_request_written_data)
- return d, request
- else:
- d = request.notifyFinish()
- d.addCallback(lambda _: request)
- d.addCallback(get_request_written_data)
- return d, request
+ # result is NOT_DONE_YET
+ d = succeed(request) if request.finished else request.notifyFinish()
+ d.addCallback(get_request_written_data)
+ return d, request
def run_on_a_thread(self, logfile='/tmp/app_test_client.log', port=4567, host='0.0.0.0'):
def _start():
diff --git a/service/test/support/integration/soledad_test_base.py b/service/test/support/integration/soledad_test_base.py
index f7693ad4..eea510b9 100644
--- a/service/test/support/integration/soledad_test_base.py
+++ b/service/test/support/integration/soledad_test_base.py
@@ -13,8 +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/>.
-import unittest
-
+from twisted.trial import unittest
from pixelated.resources import *
from test.support.integration.app_test_client import AppTestClient
from test.support.integration.model import ResponseMail