kopia lustrzana https://github.com/simonw/s3-credentials
Fixed error when returning empty bucket, closes #76
rodzic
5a9814d396
commit
30e07d3e68
|
@ -1169,7 +1169,7 @@ def stream_indented_json(iterator, indent=2):
|
|||
def paginate(service, method, list_key, **kwargs):
|
||||
paginator = service.get_paginator(method)
|
||||
for response in paginator.paginate(**kwargs):
|
||||
yield from response[list_key]
|
||||
yield from response.get(list_key) or []
|
||||
|
||||
|
||||
def fix_json(row):
|
||||
|
|
|
@ -997,6 +997,15 @@ def test_list_bucket(stub_s3, options, expected):
|
|||
assert result.output == expected
|
||||
|
||||
|
||||
def test_list_bucket_empty(stub_s3):
|
||||
stub_s3.add_response("list_objects_v2", {})
|
||||
runner = CliRunner()
|
||||
with runner.isolated_filesystem():
|
||||
result = runner.invoke(cli, ["list-bucket", "test-bucket"])
|
||||
assert result.exit_code == 0
|
||||
assert result.output == "[]\n"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def stub_iam_for_list_roles(stub_iam):
|
||||
stub_iam.add_response(
|
||||
|
|
Ładowanie…
Reference in New Issue