title: Mock an internal object call in a Flask view - with pytest
body: <p>Based on the following example:</p>
  <pre class="lang-py prettyprint-override"><code>app = Flask(__name__)
  
  @app.route('/users')
  def get_users():
      return UsersAPI().get_users()
  </code></pre>
  <p>And the following tests (using <code>pytest</code> and <code>pytest-mock</code>):</p>
  <pre class="lang-py prettyprint-override"><code>@pytest.fixture
  def users():
      return UsersAPI(how_many=1)
  
  
  def test_simple(users, mocker):
      mocker.patch(&quot;???&quot;, return_value=users)
  </code></pre>
  <p>I simply want to call <code>UsersAPI(how_many=1)</code> instead of <code>UsersAPI()</code>. Is this possible to do?</p>
  <p>(if you know how to get done with <code>unittest.mock</code> that is also fine since <code>pytest-mock</code> is simply some <code>pytest</code> wrapper)</p>