From fe06c3a839bdc13384250924a4a30d9dd3455fc7 Mon Sep 17 00:00:00 2001 From: Roald de Vries Date: Wed, 23 Nov 2016 10:02:38 +0100 Subject: fix archive resource unit test --- service/test/unit/resources/test_archive_resource.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/service/test/unit/resources/test_archive_resource.py b/service/test/unit/resources/test_archive_resource.py index 28078222..186078a5 100644 --- a/service/test/unit/resources/test_archive_resource.py +++ b/service/test/unit/resources/test_archive_resource.py @@ -1,4 +1,4 @@ -import unittest +from twisted.trial import unittest import json from mockito import mock, when, verify from test.unit.resources import DummySite @@ -15,11 +15,16 @@ class TestArchiveResource(unittest.TestCase): def test_render_POST_should_archive_mails(self): request = DummyRequest(['/mails/archive']) request.method = 'POST' + idents = ['1', '2'] content = mock() when(content).read().thenReturn(json.dumps({'idents': ['1', '2']})) - when(self.mail_service).archive_mail('1').thenReturn(defer.Deferred()) - when(self.mail_service).archive_mail('2').thenReturn(defer.Deferred()) + d1 = defer.Deferred() + d1.callback(None) + when(self.mail_service).archive_mail('1').thenReturn(d1) + d2 = defer.Deferred() + d2.callback(None) + when(self.mail_service).archive_mail('2').thenReturn(d2) request.content = content d = self.web.get(request) -- cgit v1.2.3