filer_multipart_test.go 904 B

1234567891011121314151617181920212223242526
  1. package s3api
  2. import (
  3. "github.com/aws/aws-sdk-go/aws"
  4. "github.com/aws/aws-sdk-go/service/s3"
  5. "testing"
  6. )
  7. func TestInitiateMultipartUploadResult(t *testing.T) {
  8. expected := `<?xml version="1.0" encoding="UTF-8"?>
  9. <InitiateMultipartUploadResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Bucket>example-bucket</Bucket><Key>example-object</Key><UploadId>VXBsb2FkIElEIGZvciA2aWWpbmcncyBteS1tb3ZpZS5tMnRzIHVwbG9hZA</UploadId></InitiateMultipartUploadResult>`
  10. response := &InitiateMultipartUploadResult{
  11. CreateMultipartUploadOutput: s3.CreateMultipartUploadOutput{
  12. Bucket: aws.String("example-bucket"),
  13. Key: aws.String("example-object"),
  14. UploadId: aws.String("VXBsb2FkIElEIGZvciA2aWWpbmcncyBteS1tb3ZpZS5tMnRzIHVwbG9hZA"),
  15. },
  16. }
  17. encoded := string(encodeResponse(response))
  18. if encoded != expected {
  19. t.Errorf("unexpected output: %s\nexpecting:%s", encoded, expected)
  20. }
  21. }