1
0
Fork 0
mirror of https://github.com/Luzifer/cloudkeys-go.git synced 2024-11-14 08:52:44 +00:00
cloudkeys-go/vendor/github.com/aws/aws-sdk-go/service/cloudsearchdomain/customizations_test.go
Knut Ahlers 7581358922
Switch to dep for vendoring, update dependencies
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2017-12-08 13:03:10 +01:00

63 lines
1.6 KiB
Go

package cloudsearchdomain_test
import (
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting/unit"
"github.com/aws/aws-sdk-go/service/cloudsearchdomain"
)
func TestRequireEndpointIfRegionProvided(t *testing.T) {
svc := cloudsearchdomain.New(unit.Session, &aws.Config{
Region: aws.String("mock-region"),
DisableParamValidation: aws.Bool(true),
})
req, _ := svc.SearchRequest(nil)
err := req.Build()
if e, a := "", svc.Endpoint; e != a {
t.Errorf("expect %v, got %v", e, a)
}
if err == nil {
t.Errorf("expect error, got none")
}
if e, a := aws.ErrMissingEndpoint, err; e != a {
t.Errorf("expect %v, got %v", e, a)
}
}
func TestRequireEndpointIfNoRegionProvided(t *testing.T) {
svc := cloudsearchdomain.New(unit.Session, &aws.Config{
DisableParamValidation: aws.Bool(true),
})
req, _ := svc.SearchRequest(nil)
err := req.Build()
if e, a := "", svc.Endpoint; e != a {
t.Errorf("expect %v, got %v", e, a)
}
if err == nil {
t.Errorf("expect error, got none")
}
if e, a := aws.ErrMissingEndpoint, err; e != a {
t.Errorf("expect %v, got %v", e, a)
}
}
func TestRequireEndpointUsed(t *testing.T) {
svc := cloudsearchdomain.New(unit.Session, &aws.Config{
Region: aws.String("mock-region"),
DisableParamValidation: aws.Bool(true),
Endpoint: aws.String("https://endpoint"),
})
req, _ := svc.SearchRequest(nil)
err := req.Build()
if e, a := "https://endpoint", svc.Endpoint; e != a {
t.Errorf("expect %v, got %v", e, a)
}
if err != nil {
t.Errorf("expect no error, got %v", err)
}
}