In your example you are testing your mock.
- You create a mock of
ISightRequestingEngine
- You call
startEngine()
method of that mock - You verify that the mocked object was called
What you want to do is:
- Mock out
testFunc()
- Call
startEngine()
- Verify that
testFunc()
was called
I'm not familiar with mockito, but what from what I can make up from the documentation, I think you have to do something like the following:
from mockito import mock, verify
# Setup ---------------------------------------------
my_mock = mock(ISightRequestingEngine)
system_under_test = ISightRequestingEngine()
system_under_test.testFunc = my_mock.testfunc # Mock out only testFunc()
# Exercise ------------------------------------------
system_under_test.startEngine()
# Verify --------------------------------------------
verify(my_mock).testFunc()