Damian,
I am attempting to write a test using test.mocking.mock_method, but I do not understand how to use it correctly. Could you give me pointers on the following smallest (non-)working test case.
import stem
from stem.control import Controller
import test.mocking as mocking
socket = stem.socket.ControlSocket()
controller = Controller(socket)
mocking.mock_method(Controller, 'get_version', mocking.return_value(stem.version.Version('0.1.0.14')))
controller.get_version()
The above code fails with:
Traceback (most recent call last):
File "mock_method-test.py", line 8, in <module>
mocking.mock_method(Controller, 'get_version', mocking.return_value(stem.version.Version('0.1.0.14')))
File "stem.dev/test/mocking.py", line 317, in mock_method
target_class.__dict__[method_name] = mock_wrapper
TypeError: 'dictproxy' object does not support item assignment
--
Sean Robinson