I have to test if the method pyautogui.click() is called. This is my Player.py file:
# Player.py
import pyautogui
class Player:
def play():
pyautogui.click(100, 100)
And this is my test file:
# Test_Player.py
import unittest
from Player import Player
class Test_Player(unittest.TestCase):
def test_play(self):
player = Player()
player.play()
# assert pyautogui.click is called once
I tried with pyautogui.click = MagicMock() and also many other things but I really cannot find how to assert that pyautogui.click() is called once.