Merge lp:~chad.smith/landscape-client/mocker-to-mock-activeprocess into lp:~landscape/landscape-client/trunk

Proposed by Chad Smith
Status: Merged
Approved by: Chad Smith
Approved revision: 863
Merged at revision: 869
Proposed branch: lp:~chad.smith/landscape-client/mocker-to-mock-activeprocess
Merge into: lp:~landscape/landscape-client/trunk
Diff against target: 34 lines (+5/-5)
1 file modified
landscape/monitor/tests/test_activeprocessinfo.py (+5/-5)
To merge this branch: bzr merge lp:~chad.smith/landscape-client/mocker-to-mock-activeprocess
Reviewer Review Type Date Requested Status
🤖 Landscape Builder test results Approve
Adam Collard (community) Approve
Simon Poirier (community) Approve
Review via email: mp+297543@code.launchpad.net

Commit message

Mocker to mock activeprocess unit tests.

Description of the change

Mocker to mock activeprocess unit tests.

To post a comment you must log in.
Revision history for this message
Simon Poirier (simpoir) wrote :

+1 with an inline suggestion.

review: Approve
Revision history for this message
Adam Collard (adam-collard) wrote :

+1 assuming the revert of the changes to the test_processorinfo

review: Approve
Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :
review: Approve (test results)
862. By Chad Smith

use return_value in Mock init as side_effect hacking is unnecessary for a single call

863. By Chad Smith

lint fix

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'landscape/monitor/tests/test_activeprocessinfo.py'
2--- landscape/monitor/tests/test_activeprocessinfo.py 2014-09-01 13:16:02 +0000
3+++ landscape/monitor/tests/test_activeprocessinfo.py 2016-06-15 21:11:06 +0000
4@@ -9,7 +9,7 @@
5 from landscape.monitor.activeprocessinfo import ActiveProcessInfo
6 from landscape.tests.helpers import (LandscapeTest, MonitorHelper,
7 ProcessDataBuilder)
8-from landscape.tests.mocker import ANY
9+from mock import ANY, Mock
10
11
12 class ActiveProcessInfoTest(LandscapeTest):
13@@ -533,10 +533,8 @@
14 plugin = ActiveProcessInfo(proc_dir=self.sample_dir, uptime=10)
15 self.monitor.add(plugin)
16
17- broker_mock = self.mocker.replace(self.monitor.broker)
18- broker_mock.send_message(ANY, ANY, urgent=ANY)
19- self.mocker.result(fail(MyException()))
20- self.mocker.replay()
21+ self.monitor.broker.send_message = Mock(
22+ return_value=fail(MyException()))
23
24 message = plugin.get_message()
25
26@@ -545,6 +543,8 @@
27
28 result = plugin.exchange()
29 result.addCallback(assert_message)
30+ self.monitor.broker.send_message.assert_called_once_with(
31+ ANY, ANY, urgent=ANY)
32 return result
33
34 def test_process_updates(self):

Subscribers

People subscribed via source and target branches

to all changes: