open-vault/builtin/logical/aws/secret_access_keys_test.go

26 lines
651 B
Go
Raw Normal View History

package aws
import (
"testing"
)
func TestNormalizeDisplayName(t *testing.T) {
invalidName := "^#$test name\nshould be normalized)(*"
expectedName := "___test_name_should_be_normalized___"
normalizedName := normalizeDisplayName(invalidName)
if normalizedName != expectedName {
2015-08-26 16:26:20 +00:00
t.Fatalf(
"normalizeDisplayName does not normalize AWS name correctly: %s",
normalizedName)
}
validName := "test_name_should_normalize_to_itself@example.com"
normalizedValidName := normalizeDisplayName(validName)
if normalizedValidName != validName {
t.Fatalf(
"normalizeDisplayName erroneously normalizes valid names: %s",
normalizedName)
}
}