terraform/builtin/providers/aws/website_endpoint_url_test.go

29 lines
1.0 KiB
Go

package aws
import "testing"
// http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html
var websiteEndpoints = []struct {
in string
out string
}{
{"", "bucket-name.s3-website-us-east-1.amazonaws.com"},
{"us-west-2", "bucket-name.s3-website-us-west-2.amazonaws.com"},
{"us-west-1", "bucket-name.s3-website-us-west-1.amazonaws.com"},
{"eu-west-1", "bucket-name.s3-website-eu-west-1.amazonaws.com"},
{"eu-central-1", "bucket-name.s3-website.eu-central-1.amazonaws.com"},
{"ap-southeast-1", "bucket-name.s3-website-ap-southeast-1.amazonaws.com"},
{"ap-northeast-1", "bucket-name.s3-website-ap-northeast-1.amazonaws.com"},
{"ap-southeast-2", "bucket-name.s3-website-ap-southeast-2.amazonaws.com"},
{"sa-east-1", "bucket-name.s3-website-sa-east-1.amazonaws.com"},
}
func TestWebsiteEndpointUrl(t *testing.T) {
for _, tt := range websiteEndpoints {
s := WebsiteEndpoint("bucket-name", tt.in)
if s.Endpoint != tt.out {
t.Errorf("WebsiteEndpointUrl(\"bucket-name\", %q) => %q, want %q", tt.in, s.Endpoint, tt.out)
}
}
}