Getting return value problems with unittest patch() in python
<p>I am trying to use mock.patch to unittest my code, however I am getting a strange result. This is the important part of the code:</p>

<pre><code>@mock.patch('benchmark.scenarios.networking.feature.ssh')
@mock.patch('benchmark.scenarios.networking.feature.subprocess.call')
def test_run_for_success(self, mock_subprocess, mock_ssh):
    mock_ssh.SSH().execute.return_value = (0, '100', '')
    mock_subprocess.call().return_value = 'mocked!'

    result = {}
    self.feature.run(result)
</code></pre>

<p>When I run ssh in my code, I get the returned value: <code>(0, '100', '')</code>, good! However, when I run <code>subprocess.call()</code> I get as returned value:</p>

<pre><code>&lt;MagicMock name='subprocess.call()' id='139806699670096'&gt;
</code></pre>

<p>What am I doing wrong? I would like to get 'mocked!' as returned value.</p>