有没有人能给我指出正确的方向?我尝试将moto (https://github.com/spulec/moto)作为后端服务运行,这样我就可以测试我的应用程序了。我能够按照建议运行moto服务并加载moto-api的网页(http://localhost:5000/moto-api/#)。
我有一个问题,我如何设置此后端服务的所有测试存储桶和实例?
谢谢。
发布于 2020-04-17 17:05:51
如果被测应用程序假设存储桶存在,您只需创建存储桶作为测试的一部分:
@mock_s3
def test_something():
client = boto3.client("s3", endpoint_url="http://localhost:5000")
client.create_bucket(Bucket="test-bucket")
# Call whatever function/business logic you're trying to test, that assumes a bucket called 'test-bucket' exists
something()https://stackoverflow.com/questions/60721515
复制相似问题