Add StreamSummaries to the respose of kinesis.list_streams (#7490)

This commit is contained in:
LMaterne 2024-03-19 21:54:47 +01:00 committed by GitHub
parent db862bcf3b
commit 565d2bb251
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 33 additions and 2 deletions

View File

@ -53,7 +53,14 @@ class KinesisResponse(BaseResponse):
has_more_streams = True
return json.dumps(
{"HasMoreStreams": has_more_streams, "StreamNames": streams_resp}
{
"HasMoreStreams": has_more_streams,
"StreamNames": streams_resp,
"StreamSummaries": [
stream.to_json_summary()["StreamDescriptionSummary"]
for stream in streams
],
}
)
def delete_stream(self) -> str:

View File

@ -137,6 +137,26 @@ def test_describe_stream_summary():
assert stream["StreamName"] == stream_name
@mock_aws
def test_list_streams_stream_discription():
conn = boto3.client("kinesis", region_name="us-west-2")
for i in range(3):
conn.create_stream(StreamName=f"stream{i}", ShardCount=i+1)
resp = conn.list_streams()
assert len(resp["StreamSummaries"]) == 3
for i, stream in enumerate(resp["StreamSummaries"]):
stream_name = f"stream{i}"
assert stream["StreamName"] == stream_name
assert (
stream["StreamARN"]
== f"arn:aws:kinesis:us-west-2:{ACCOUNT_ID}:stream/{stream_name}"
)
assert stream["StreamStatus"] == "ACTIVE"
assert stream.get("StreamCreationTimestamp")
@mock_aws
def test_basic_shard_iterator():
client = boto3.client("kinesis", region_name="us-west-1")

View File

@ -12,4 +12,8 @@ def test_list_streams():
res = test_client.get("/?Action=ListStreams")
json_data = json.loads(res.data.decode("utf-8"))
assert json_data == {"HasMoreStreams": False, "StreamNames": []}
assert json_data == {
"HasMoreStreams": False,
"StreamNames": [],
"StreamSummaries": []
}