I need to do unittest for a method that has 2 rest calls and another method call. To describe in details, it is as below:
class A():
def methA(self, param1):
val1 = methB(someParam)
res1 = requests.get(url1, headers=headers, verify=False)
res2 = requests.post(endpoint, payload, headers=headers, verify=False)
val2 = methC(someParam)
return val2
def methB(self, param1):
res = requests.get(url, headers=headers, verify=False)
return res
def methC(self, param1):
res = requests.get(url, headers=headers, verify=False)
return res
Now, for methods methB and methC, I have mocked the rest call with the solution given here. But with methA() I am not able to patch the mock for two different REST call of two different type (GET and POST). What is the possible solution to mock this scenario? Thnaks in advance.