2015-05-06 17:12:16 +02:00
|
|
|
package aws
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
2015-06-07 11:39:18 +02:00
|
|
|
// 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"},
|
2016-07-19 10:01:49 +02:00
|
|
|
{"ap-south-1", "bucket-name.s3-website.ap-south-1.amazonaws.com"},
|
2015-06-07 11:39:18 +02:00
|
|
|
{"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"},
|
2016-09-24 10:42:52 +02:00
|
|
|
{"ap-northeast-2", "bucket-name.s3-website.ap-northeast-2.amazonaws.com"},
|
2015-06-07 11:39:18 +02:00
|
|
|
{"sa-east-1", "bucket-name.s3-website-sa-east-1.amazonaws.com"},
|
2015-05-06 17:12:16 +02:00
|
|
|
}
|
|
|
|
|
2015-06-07 11:39:18 +02:00
|
|
|
func TestWebsiteEndpointUrl(t *testing.T) {
|
|
|
|
for _, tt := range websiteEndpoints {
|
2015-06-03 17:10:17 +02:00
|
|
|
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)
|
2015-06-07 11:39:18 +02:00
|
|
|
}
|
2015-05-06 17:12:16 +02:00
|
|
|
}
|
|
|
|
}
|