I want to check if a local function (declared on the test itself) is called.
For example:
def test_handle_action():
action = "test"
user = "uid"
room = "room"
content = "test"
data = {}
def test_this(user, room, content, data):
pass
handlers = {action: test_this}
with mock.patch("handlers.handlers", handlers):
with mock.patch(".test_this") as f:
handle_action(action, user, room, content, data)
f.assert_called_with()
How can I mock path the function test_this
inside my test?
With .test_this
I got the error:
E ValueError: Empty module name