'how to write pytest for attribute service call using monkey patch was called?

I have one function for calling attribute service call. Now I want to write pytest for that using monkey patch. How to write test code for this monkey patch was called?

def attr_service_call(attr_url):
    PARAMS = {'username':'username', 'password':'password'}
    resp = requests.get(attr_url, params=PARAMS, timeout= 30)
    resp_json = resp.json()
    resturn resp_json

How to write pytest for above code and and attr service call was called using monkey patching. Help me to write pytest for this. Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source