有没有办法在patch
装饰器中捕获以下逻辑,而不必将模拟传递给函数:
@patch('boto3.client')
def test_playing_with_saml(self, boto3_client):
boto3_client.return_value.assume_role_with_saml = lambda *args, **kwargs: ('foo', 'bar')
self.assertEqual(playing_with_saml(), 'expected')