I want to mock functions to using in unit test.
for example:
def b():
return False
def a():
b1 = b()
b2 = b()
.....
I want to see at first b() calling see "False" and at the second b() calling see "True" or in other examples call "find_one" function twice
def check_item(user_id:str,item_id):
# at first check user exist or not
user=db.find_one('user',user_id)
if not user:
return False
item=db.find_one('item',item_id)
if not item:
return False
return True
(I know it's not a good way to handle checking items and should create a separate function and add own logic to them :D )
For Mocking the "find_one" function we consider want at the first call isn't none and at the second call should see none.