summaryrefslogtreecommitdiff
path: root/service/test/unit/resources/test_login_resource.py
diff options
context:
space:
mode:
authorRoald de Vries <rdevries@thoughtworks.com>2016-10-06 17:03:44 -0300
committerRoald de Vries <rdevries@thoughtworks.com>2016-10-07 18:25:02 -0300
commitf4d7541c9b6dcf67b57b13f7ca7434ec68eeb59c (patch)
tree8d50a54a9a8d5dd451253e55275f209f9df32b0a /service/test/unit/resources/test_login_resource.py
parent4642cee939c08bfa809f55b6a85ffa773600eaf9 (diff)
use test client in test case through composition instead of inheritance
Diffstat (limited to 'service/test/unit/resources/test_login_resource.py')
-rw-r--r--service/test/unit/resources/test_login_resource.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/service/test/unit/resources/test_login_resource.py b/service/test/unit/resources/test_login_resource.py
index 6383e25c..0ff9ec91 100644
--- a/service/test/unit/resources/test_login_resource.py
+++ b/service/test/unit/resources/test_login_resource.py
@@ -1,7 +1,5 @@
import os
-import test.support.mockito
-
from leap.bonafide._srp import SRPAuthError
from mock import patch
from mockito import mock, when, any as ANY, verify, verifyZeroInteractions, verifyNoMoreInteractions
@@ -13,6 +11,7 @@ from pixelated.config.sessions import LeapSession
from pixelated.resources.login_resource import LoginResource
from pixelated.resources.login_resource import parse_accept_language
from test.unit.resources import DummySite
+from test.support.mockito import AnswerSelector
class TestParseAcceptLanguage(unittest.TestCase):
@@ -194,7 +193,8 @@ class TestLoginPOST(unittest.TestCase):
def test_login_responds_interstitial_and_add_corresponding_session_to_services_factory(self):
irrelevant = None
when(self.portal).login(ANY(), None, IResource).thenReturn((irrelevant, self.leap_session, irrelevant))
- when(self.services_factory).create_services_from(self.leap_session).thenAnswer(self.mock_user_has_services_setup)
+ with patch('mockito.invocation.AnswerSelector', AnswerSelector):
+ when(self.services_factory).create_services_from(self.leap_session).thenAnswer(self.mock_user_has_services_setup)
d = self.web.get(self.request)