summaryrefslogtreecommitdiff
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 10:02:38 +0100
commit59644fafb501422295d430912d8711a7d11195b5 (patch)
tree48f42a6f555e4a136dcf0a5e99c2aa4c1bde3b08
parent68c2667fc568055c7bf6a676e1f12e61154fbab6 (diff)
fix archive resource unit test
-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)