github.com/webdestroya/awsmocker@v0.2.6/error_test.go (about)

     1  package awsmocker
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  )
     8  
     9  func TestErrorResponse_getResponse(t *testing.T) {
    10  	t.Run("XML", func(t *testing.T) {
    11  		er := generateErrorStruct(418, "GenericErrorCode", "Some %s message %d", "THING", 123)
    12  
    13  		hr := er.getResponse(&ReceivedRequest{AssumedResponseType: ContentTypeXML})
    14  		require.Equal(t, 418, hr.StatusCode)
    15  		require.Equal(t, ContentTypeXML, hr.contentType)
    16  		require.Contains(t, hr.Body, "<Type>Sender</Type>")
    17  	})
    18  }