func TestInputService5ProtocolTestRecursiveShapesCase1(t *testing.T) { svc := NewInputService5ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService5TestShapeInputShape{ RecursiveStruct: &InputService5TestShapeRecursiveStructType{ NoRecurse: aws.String("foo"), }, } req, _ := svc.InputService5TestCaseOperation1Request(input) r := req.HTTPRequest // build request jsonrpc.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`{"RecursiveStruct":{"NoRecurse":"foo"}}`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) }
func TestInputService7ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { svc := NewInputService7ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService7TestShapeInputShape{ BlobArg: []byte("foo"), } req, _ := svc.InputService7TestCaseOperation1Request(input) r := req.HTTPRequest // build request ec2query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`Action=OperationName&BlobArg=Zm9v&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func TestInputService5ProtocolTestSerializeMapTypeCase2(t *testing.T) { svc := NewInputService5ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService5TestShapeInputShape{ MapArg: map[string]*string{}, } req, _ := svc.InputService5TestCaseOperation2Request(input) r := req.HTTPRequest // build request query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`Action=OperationName&MapArg=&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func TestInputService4ProtocolTestNestedBlobsCase1(t *testing.T) { svc := NewInputService4ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService4TestShapeInputShape{ ListParam: [][]byte{ []byte("foo"), []byte("bar"), }, } req, _ := svc.InputService4TestCaseOperation1Request(input) r := req.HTTPRequest // build request jsonrpc.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`{"ListParam":["Zm9v","YmFy"]}`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) }
func TestInputService3ProtocolTestBase64EncodedBlobsCase2(t *testing.T) { svc := NewInputService3ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService3TestShapeInputShape{ BlobMap: map[string][]byte{ "key1": []byte("foo"), "key2": []byte("bar"), }, } req, _ := svc.InputService3TestCaseOperation2Request(input) r := req.HTTPRequest // build request jsonrpc.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`{"BlobMap":{"key1":"Zm9v","key2":"YmFy"}}`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) }
func TestInputService2ProtocolTestTimestampValuesCase1(t *testing.T) { svc := NewInputService2ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService2TestShapeInputShape{ TimeArg: aws.Time(time.Unix(1422172800, 0)), } req, _ := svc.InputService2TestCaseOperation1Request(input) r := req.HTTPRequest // build request jsonrpc.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`{"TimeArg":1422172800}`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type")) assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target")) }
func TestInputService8ProtocolTestTimestampValuesCase1(t *testing.T) { svc := NewInputService8ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService8TestShapeInputShape{ TimeArg: aws.Time(time.Unix(1422172800, 0)), } req, _ := svc.InputService8TestCaseOperation1Request(input) r := req.HTTPRequest // build request ec2query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`Action=OperationName&TimeArg=2015-01-25T08%3A00%3A00Z&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func TestInputService6ProtocolTestListWithLocationNameAndQueryNameCase1(t *testing.T) { svc := NewInputService6ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService6TestShapeInputShape{ ListArg: []*string{ aws.String("a"), aws.String("b"), aws.String("c"), }, } req, _ := svc.InputService6TestCaseOperation1Request(input) r := req.HTTPRequest // build request ec2query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`Action=OperationName&ListQueryName.1=a&ListQueryName.2=b&ListQueryName.3=c&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func TestInputService3ProtocolTestNestedStructureMembersCase1(t *testing.T) { svc := NewInputService3ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService3TestShapeInputShape{ StructArg: &InputService3TestShapeStructType{ ScalarArg: aws.String("foo"), }, } req, _ := svc.InputService3TestCaseOperation1Request(input) r := req.HTTPRequest // build request ec2query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`Action=OperationName&Struct.Scalar=foo&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func TestInputService2ProtocolTestStructureWithLocationNameAndQueryNameAppliedToMembersCase1(t *testing.T) { svc := NewInputService2ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService2TestShapeInputShape{ Bar: aws.String("val2"), Foo: aws.String("val1"), Yuck: aws.String("val3"), } req, _ := svc.InputService2TestCaseOperation1Request(input) r := req.HTTPRequest // build request ec2query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`Action=OperationName&BarLocationName=val2&Foo=val1&Version=2014-01-01&yuckQueryName=val3`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func TestInputService9ProtocolTestRecursiveShapesCase6(t *testing.T) { svc := NewInputService9ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService9TestShapeInputShape{ RecursiveStruct: &InputService9TestShapeRecursiveStructType{ RecursiveMap: map[string]*InputService9TestShapeRecursiveStructType{ "bar": { NoRecurse: aws.String("bar"), }, "foo": { NoRecurse: aws.String("foo"), }, }, }, } req, _ := svc.InputService9TestCaseOperation6Request(input) r := req.HTTPRequest // build request query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`Action=OperationName&RecursiveStruct.RecursiveMap.entry.1.key=bar&RecursiveStruct.RecursiveMap.entry.1.value.NoRecurse=bar&RecursiveStruct.RecursiveMap.entry.2.key=foo&RecursiveStruct.RecursiveMap.entry.2.value.NoRecurse=foo&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func TestInputService6ProtocolTestSerializeMapTypeWithLocationNameCase1(t *testing.T) { svc := NewInputService6ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService6TestShapeInputShape{ MapArg: map[string]*string{ "key1": aws.String("val1"), "key2": aws.String("val2"), }, } req, _ := svc.InputService6TestCaseOperation1Request(input) r := req.HTTPRequest // build request query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`Action=OperationName&MapArg.entry.1.TheKey=key1&MapArg.entry.1.TheValue=val1&MapArg.entry.2.TheKey=key2&MapArg.entry.2.TheValue=val2&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func TestInputService4ProtocolTestFlattenedListCase2(t *testing.T) { svc := NewInputService4ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService4TestShapeInputShape{ ListArg: []*string{}, ScalarArg: aws.String("foo"), } req, _ := svc.InputService4TestCaseOperation2Request(input) r := req.HTTPRequest // build request query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`Action=OperationName&ListArg=&ScalarArg=foo&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
func TestInputService3ProtocolTestListTypesCase1(t *testing.T) { svc := NewInputService3ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService3TestShapeInputShape{ ListArg: []*string{ aws.String("foo"), aws.String("bar"), aws.String("baz"), }, } req, _ := svc.InputService3TestCaseOperation1Request(input) r := req.HTTPRequest // build request query.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body, _ := ioutil.ReadAll(r.Body) assert.Equal(t, util.Trim(`Action=OperationName&ListArg.member.1=foo&ListArg.member.2=bar&ListArg.member.3=baz&Version=2014-01-01`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/", r.URL.String()) // assert headers }
"github.com/kingsoft-avteam/aws-sdk-go/aws" "github.com/kingsoft-avteam/aws-sdk-go/internal/protocol/ec2query" "github.com/kingsoft-avteam/aws-sdk-go/internal/protocol/xml/xmlutil" "github.com/kingsoft-avteam/aws-sdk-go/internal/signer/v4" "github.com/kingsoft-avteam/aws-sdk-go/internal/util" "github.com/stretchr/testify/assert" ) var _ bytes.Buffer // always import bytes var _ http.Request var _ json.Marshaler var _ time.Time var _ xmlutil.XMLNode var _ xml.Attr var _ = ioutil.Discard var _ = util.Trim("") var _ = url.Values{} var _ = io.EOF // OutputService1ProtocolTest is a client for OutputService1ProtocolTest. type OutputService1ProtocolTest struct { *aws.Service } // New returns a new OutputService1ProtocolTest client. func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTest { service := &aws.Service{ Config: aws.DefaultConfig.Merge(config), ServiceName: "outputservice1protocoltest", APIVersion: "", }