You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
904 B

  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. }