package s3api
import (
"encoding/xml"
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestGetCallerIdentityResponse_XMLMarshal(t *testing.T) {
response := &GetCallerIdentityResponse{
Result: GetCallerIdentityResult{
Arn: fmt.Sprintf("arn:aws:iam::%s:user/alice", defaultAccountID),
UserId: "alice",
Account: defaultAccountID,
},
}
response.ResponseMetadata.RequestId = "test-request-id"
data, err := xml.MarshalIndent(response, "", " ")
require.NoError(t, err)
xmlStr := string(data)
assert.Contains(t, xmlStr, "GetCallerIdentityResponse")
assert.Contains(t, xmlStr, "GetCallerIdentityResult")
assert.Contains(t, xmlStr, "arn:aws:iam::000000000000:user/alice")
assert.Contains(t, xmlStr, "alice")
assert.Contains(t, xmlStr, "000000000000")
assert.Contains(t, xmlStr, "test-request-id")
assert.Contains(t, xmlStr, "https://sts.amazonaws.com/doc/2011-06-15/")
}