summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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