From 5dfd6a24111b708c9aa1280d34d376bba164d7e1 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Wed, 28 Jan 2015 09:29:51 -0300 Subject: for #256, change TestCase to twisted trial --- service/test/support/integration/soledad_test_base.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'service/test/support') 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 . -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 -- cgit v1.2.3 From cf9982ed9469ba10ddb1064b68905b8411251ece Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Wed, 28 Jan 2015 11:00:27 -0200 Subject: Fixing _render function on app_test_client for integration tests so that when result is NOT_DONE_YET but the request is finished already we return a simple succeed defer --- service/test/support/integration/app_test_client.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'service/test/support') 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(): -- cgit v1.2.3