As the title says, I'm having a little trouble trying to check that my function under test is decorated with the correct decorator for one, and secondly the right parameters.
Method under test
@command_wrapper.command('string1', 'string2')
def function_under_test():
return some_other_function();
Unit test
@patch("command_wrapper.command")
def test_function_under_test(self, mock_command_wrapper)
* Do some testing *
Decorator: command_wrapper.py
def command(string1, string2):
cmd_decorator(func):
@wraps(func)
def func_wrapper():
* Do some code *
return func_wrapper
return cmd_decorator
However when the test runs, its clearly executing the decorator without having mocked it. I'm new to Python so I'm not even sure if this is possible, or whether this is the right approach.