Open icyc9 opened 8 years ago
That's because download_file
and upload_file
are customizations which live in boto3. They call out to one or many requests under the hood. Right now there's not a great story for supporting customizations other than recording underlying commands they use and adding them to the stubber. There's an external library that can handle that for you, though we don't support it ourselves.
Just hit this too. It'd be really great if stubber could handle download_file
and upload_file
@JordonPhillips Thanks for your reply. What's the external library that mocks the upload_file()
?
placebo, though it runs in a different way than the stubber does: it records and replays.
I just found out that 'get_paginator' seem to be the same story. It is a little confusing for me at this point as it seemed the stubber was for boto3, the relationship between botocore and boto3 is a bit unclear to me. I'll check out placebo.
Anyone found a workaround for this yet?
In case anyone else comes across, this I found that for get_paginator
, rather than adding a response with get_paginator
as the service method, instead you should add a response for the service method that get_paginator
would access. For example
Instead of:
cfn_stubber = Stubber(cloudformation_client)
cfn_stubber.add_response('get_paginator', expected_response, 'describe_stacks')
Do:
cfn_stubber = Stubber(cloudformation_client)
cfn_stubber.add_response('describe_stacks', expected_response)
The stubber does seem able to return a paginator
object that includes the data passed from the expected_response
.
Any update on how to mock upload_file
using stubber?
Any update on how to mock
upload_file
using stubber?
Use put_object
instead of upload_file
When calling stubber.add_response with certain boto3 s3 client methods I have encountered "botocore.model.OperationNotFoundError".
The test results are shown as follows.
The add_response method does not seem to allow the 'upload_file' client method to be stubbed. I have also found this to be true with the 'download_file' client method.