25 lines
630 B
Go
25 lines
630 B
Go
package tenant
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestValidateDispatcherIDCanonicalV4(t *testing.T) {
|
|
const approved = "c046b893-8628-4589-ae50-619d049248a6"
|
|
if err := ValidateDispatcherID(approved); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, id := range []string{
|
|
"", "dispatcher-a", strings.ToUpper(approved),
|
|
"00000000-0000-0000-0000-000000000000",
|
|
"c046b893-8628-1589-ae50-619d049248a6",
|
|
"c046b893-8628-4589-7e50-619d049248a6",
|
|
"c046b89386284589ae50619d049248a6", "urn:uuid:" + approved,
|
|
} {
|
|
if err := ValidateDispatcherID(id); err == nil {
|
|
t.Fatalf("invalid Dispatcher identity accepted: %q", id)
|
|
}
|
|
}
|
|
}
|