package s3api import ( "testing" "time" ) func TestListObjectsHandler(t *testing.T) { // https://docs.aws.amazon.com/AmazonS3/latest/API/v2-RESTBucketGET.html expected := ` test_container1000false1.zip"4397da7a7649e8085de9916c240e8166"123456765a011niqo39cdf8ec533ec3d1ccaafsa932STANDARD2011-04-09T12:34:49` response := ListBucketResult{ Name: "test_container", Prefix: "", Marker: "", NextMarker: "", MaxKeys: 1000, IsTruncated: false, Contents: []ListEntry{{ Key: "1.zip", LastModified: time.Date(2011, 4, 9, 12, 34, 49, 0, time.UTC), ETag: "\"4397da7a7649e8085de9916c240e8166\"", Size: 1234567, Owner: CanonicalUser{ ID: "65a011niqo39cdf8ec533ec3d1ccaafsa932", }, StorageClass: "STANDARD", }}, } encoded := string(encodeResponse(response)) if encoded != expected { t.Errorf("unexpected output: %s\nexpecting:%s", encoded, expected) } }