summaryrefslogtreecommitdiff
path: root/service/test/unit
diff options
context:
space:
mode:
authorRoald de Vries <rdevries@thoughtworks.com>2016-11-23 10:02:38 +0100
committerRoald de Vries <rdevries@thoughtworks.com>2016-11-23 11:40:54 +0100
commitfe06c3a839bdc13384250924a4a30d9dd3455fc7 (patch)
tree851c1fe0577e77c2c3fb5b7b5f54925bf763e8ea /service/test/unit
parent35817f63e7670dccc60ef566823ae31ebcc9f2de (diff)
fix archive resource unit test
Diffstat (limited to 'service/test/unit')
-rw-r--r--service/test/unit/resources/test_archive_resource.py11
1 files 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)