diff options
author | Roald de Vries <rdevries@thoughtworks.com> | 2016-10-06 17:03:44 -0300 |
---|---|---|
committer | Roald de Vries <rdevries@thoughtworks.com> | 2016-10-07 18:25:02 -0300 |
commit | f4d7541c9b6dcf67b57b13f7ca7434ec68eeb59c (patch) | |
tree | 8d50a54a9a8d5dd451253e55275f209f9df32b0a /service/test/support/integration/multi_user_client.py | |
parent | 4642cee939c08bfa809f55b6a85ffa773600eaf9 (diff) |
use test client in test case through composition instead of inheritance
Diffstat (limited to 'service/test/support/integration/multi_user_client.py')
-rw-r--r-- | service/test/support/integration/multi_user_client.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/service/test/support/integration/multi_user_client.py b/service/test/support/integration/multi_user_client.py index 2530db46..420ff54b 100644 --- a/service/test/support/integration/multi_user_client.py +++ b/service/test/support/integration/multi_user_client.py @@ -13,6 +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/>. +from mock import patch from mockito import mock, when, any as ANY from twisted.internet import defer @@ -25,8 +26,8 @@ import pixelated.config.services from pixelated.resources.root_resource import RootResource from test.support.integration import AppTestClient from test.support.integration.app_test_client import AppTestAccount, StubSRPChecker -import test.support.mockito from test.support.test_helper import request_mock +from test.support.mockito import AnswerSelector class MultiUserClient(AppTestClient): @@ -63,7 +64,8 @@ class MultiUserClient(AppTestClient): self.user_auth = session when(LeapSessionFactory).create(username, password, session).thenReturn(leap_session) - when(leap_session).initial_sync().thenAnswer(lambda: defer.succeed(None)) + with patch('mockito.invocation.AnswerSelector', AnswerSelector): + when(leap_session).initial_sync().thenAnswer(lambda: defer.succeed(None)) when(pixelated.config.services).Services(ANY()).thenReturn(self.services) request = request_mock(path='/login', method="POST", body={'username': username, 'password': password}) |