diff options
author | Bruno Wagner <bwagner@riseup.net> | 2016-09-08 11:51:32 -0300 |
---|---|---|
committer | Bruno Wagner <bwagner@riseup.net> | 2016-09-08 14:09:34 -0300 |
commit | d5d453754bb08968f0a308235074d0ec7ef78597 (patch) | |
tree | 2d1b15eb6f96c2414fda2519ae4b1479edc8a390 /service | |
parent | eb61dad1ac92c0c0e5bcce34b3aa68b50d40c518 (diff) |
Fixed test to correctly mock the mail_fetcher
Diffstat (limited to 'service')
-rw-r--r-- | service/test/unit/config/test_sessions.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/service/test/unit/config/test_sessions.py b/service/test/unit/config/test_sessions.py index be418a73..7ac6f8d1 100644 --- a/service/test/unit/config/test_sessions.py +++ b/service/test/unit/config/test_sessions.py @@ -33,20 +33,21 @@ class SessionTest(AbstractLeapTest): @patch('pixelated.config.sessions.Account') @defer.inlineCallbacks def test_background_jobs_are_started_during_initial_sync(self, *unused): - mailFetcherMock = MagicMock() + mail_fetcher_mock = MagicMock() with patch('pixelated.config.sessions.reactor.callFromThread', new=_execute_func) as _: - with patch.object(LeapSession, '_create_incoming_mail_fetcher', return_value=mailFetcherMock) as _: + with patch.object(LeapSession, '_create_incoming_mail_fetcher', return_value=mail_fetcher_mock) as _: session = self._create_session() yield session.first_required_sync() - mailFetcherMock.startService.assert_called_once() + mail_fetcher_mock.startService.assert_called_once() @patch('pixelated.config.sessions.register') @patch('pixelated.config.sessions.unregister') @patch('pixelated.config.sessions.Account') @defer.inlineCallbacks def test_that_close_stops_background_jobs(self, *unused): + mail_fetcher_mock = MagicMock() with patch('pixelated.config.sessions.reactor.callFromThread', new=_execute_func) as _: - with patch('pixelated.config.sessions.LeapSession._create_incoming_mail_fetcher') as mail_fetcher_mock: + with patch.object(LeapSession, '_create_incoming_mail_fetcher', return_value=mail_fetcher_mock) as _: session = self._create_session() yield session.first_required_sync() session.close() |