in core/src/services/s3/pager.rs [185:246]
fn test_parse_list_output() {
let bs = bytes::Bytes::from(
r#"<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>example-bucket</Name>
<Prefix>photos/2006/</Prefix>
<KeyCount>3</KeyCount>
<MaxKeys>1000</MaxKeys>
<Delimiter>/</Delimiter>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>photos/2006</Key>
<LastModified>2016-04-30T23:51:29.000Z</LastModified>
<ETag>"d41d8cd98f00b204e9800998ecf8427e"</ETag>
<Size>56</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>photos/2007</Key>
<LastModified>2016-04-30T23:51:29.000Z</LastModified>
<ETag>"d41d8cd98f00b204e9800998ecf8427e"</ETag>
<Size>100</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
<CommonPrefixes>
<Prefix>photos/2006/February/</Prefix>
</CommonPrefixes>
<CommonPrefixes>
<Prefix>photos/2006/January/</Prefix>
</CommonPrefixes>
</ListBucketResult>"#,
);
let out: Output = de::from_reader(bs.reader()).expect("must success");
assert!(!out.is_truncated.unwrap());
assert!(out.next_continuation_token.is_none());
assert_eq!(
out.common_prefixes
.iter()
.map(|v| v.prefix.clone())
.collect::<Vec<String>>(),
vec!["photos/2006/February/", "photos/2006/January/"]
);
assert_eq!(
out.contents,
vec![
OutputContent {
key: "photos/2006".to_string(),
size: 56,
etag: "\"d41d8cd98f00b204e9800998ecf8427e\"".to_string(),
last_modified: "2016-04-30T23:51:29.000Z".to_string(),
},
OutputContent {
key: "photos/2007".to_string(),
size: 100,
last_modified: "2016-04-30T23:51:29.000Z".to_string(),
etag: "\"d41d8cd98f00b204e9800998ecf8427e\"".to_string(),
}
]
)
}