【发布时间】:2021-06-16 15:44:38
【问题描述】:
我需要在我的 API post 方法中模拟两个函数。 只模拟一个函数效果很好,但是当我需要模拟两个函数时,我不知道该怎么做?
@unittest.mock.patch('path.to.first.function.thefirstfunction')
def test_connector_post(mock_thefirstfunction):
...
有什么想法吗?
【问题讨论】:
-
你可能可以堆叠装饰器!
-
感谢@ti7,它正在工作