title: How to mock library class for Pytest
body: <p>I am new in mock and tests for python code(whatever code).</p>
  
  <p>I'm trying to test my function main.py</p>
  
  <pre><code>def get_channel_list():
      sc = SlackClient(get_token())
      channels_list_json = sc.api_call("channels.list")
      if channels_list_json['ok'] == True:
          return channels_list_json
  </code></pre>
  
  <p>that is function that I'm trying to test</p>
  
  <p>I need to mock patch <code>sc.api_call("channels.list")</code> to return JSON object 
  but I can't find any examples like this that would help me to figure out how to do it.</p>
  
  <p>Evrething I found was like this example <a href="https://stackoverflow.com/questions/34406848/mocking-a-class-method-and-changing-some-object-attributes-in-python">Mocking a class method...</a></p>
  
  <p>I think it would look like this:</p>
  
  <pre><code>@patch.object(SlackClient, 'api_call')
  def test_get_channel_list():
      assert get_channel_list() != ""
  </code></pre>
  
  <p>I don't have to to test lib I need to test the rest of my code in the function that I mentioned before.
  Thanks for any help, I'm realy stack with this test.</p>