我正在使用短截线嘲笑kmsclient。我使用的代码是
with botocore.stub.Stubber(s3) as stubber:
with botocore.stub.Stubber(kms) as stubber2:
stubber.add_response('copy_object', response, expectedParams)
stubber.activate()
stubber2.add_response('decrypt', response2, expectedParams2)
stubber2.activate()
handleCore(__makeValidEvent(), None, s3, kms)
stubber.assert_no_pending_responses()
stubber2.assert_no_pending_responses()
在实际实现中,kmsclient调用发生两次,这将导致以下异常
^{pr2}$有人能告诉我如何在同一个对象上进行多个调用(本例中是kmsclient)
我通过为同一方法添加多个响应来解决这个问题。在
测试代码示例:
测试方法示例:
^{pr2}$这是有效的,没有异常。在
相关问题 更多 >
编程相关推荐