title: python pytest for testing the requests and response
body: <p>I am a beginner to using pytest in python and trying to write test cases for the following method which get the user address when correct Id is passed else rises custom error BadId.</p>
  
  <pre><code>    def get_user_info(id: str, host='127.0.0.1', port=3000 ) -&gt; str:
       uri = 'http://{}:{}/users/{}'.format(host,port,id)
       result = Requests.get(uri).json()
       address = result.get('user',{}).get('address',None)
       if address:
         return address
       else:
         raise BadId
  </code></pre>
  
  <p>Can someone help me with this and also can you suggest me what are the best resources for learning pytest? TIA</p>