github.com/aavshr/aws-sdk-go@v1.41.3/service/route53/customizations_test.go (about)

     1  package route53_test
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  
     7  	"github.com/aavshr/aws-sdk-go/aws"
     8  	"github.com/aavshr/aws-sdk-go/awstesting/unit"
     9  	"github.com/aavshr/aws-sdk-go/service/route53"
    10  )
    11  
    12  func TestBuildCorrectURI(t *testing.T) {
    13  	svc := route53.New(unit.Session)
    14  	svc.Handlers.Validate.Clear()
    15  	req, _ := svc.GetHostedZoneRequest(&route53.GetHostedZoneInput{
    16  		Id: aws.String("/hostedzone/ABCDEFG"),
    17  	})
    18  
    19  	expectPath := strings.Replace(req.Operation.HTTPPath, "{Id}", "ABCDEFG", -1)
    20  
    21  	req.HTTPRequest.URL.RawQuery = "abc=123"
    22  
    23  	req.Build()
    24  
    25  	if a, e := req.HTTPRequest.URL.Path, expectPath; a != e {
    26  		t.Errorf("expect path %q, got %q", e, a)
    27  	}
    28  
    29  	if a, e := req.HTTPRequest.URL.RawPath, expectPath; a != e {
    30  		t.Errorf("expect raw path %q, got %q", e, a)
    31  	}
    32  
    33  	if a, e := req.HTTPRequest.URL.RawQuery, "abc=123"; a != e {
    34  		t.Errorf("expect query to be %q, got %q", e, a)
    35  	}
    36  }