When a method should be mocked within a test case it is possible to apply the @mock.patch decorator in the python unittest framework (see 1):
class MyTest(TestCase):
@patch('method2')
@patch('method1')
def test_stuff(self, mock_method1, mock_method_2):
...
According to the docs 2, it is also possible to apply the @mock.patch as a class decorator:
@patch('method2')
@patch('method1')
class MyTest(TestCase):
def test_stuff(self, mock_method_1, mock_method_2):
...
So it should also be possible and reasonable to combine these two approaches:
@patch('method1')
class MyTest(TestCase):
@patch('method2')
def test_stuff(self, mock_method_A, mock_method_B):
...
Now I was wondering in which order the mocks are passed to test_stuff.
So does mock_method_A mock method1 or method2?