You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
679 B
37 lines
679 B
package s3bucket
|
|
|
|
import (
|
|
"github.com/stretchr/testify/assert"
|
|
"testing"
|
|
)
|
|
|
|
func Test_verifyBucketName(t *testing.T) {
|
|
invalidS3BucketNames := []string{
|
|
"A9325325b",
|
|
"123.12.153.10",
|
|
"abc214..2",
|
|
"d",
|
|
".ewfs3253543",
|
|
"grehtrry-",
|
|
"----------",
|
|
"x@fdsgr032",
|
|
}
|
|
for _, invalidName := range invalidS3BucketNames {
|
|
err := VerifyS3BucketName(invalidName)
|
|
assert.NotNil(t, err)
|
|
}
|
|
validS3BucketName := []string{
|
|
"a9325325b",
|
|
"999.12.153.10",
|
|
"abc214.2",
|
|
"3d3d3d",
|
|
"ewfs3253543",
|
|
"grehtrry-a",
|
|
"0----------0",
|
|
"xafdsgr032",
|
|
}
|
|
for _, invalidName := range validS3BucketName {
|
|
err := VerifyS3BucketName(invalidName)
|
|
assert.Nil(t, err)
|
|
}
|
|
}
|