feat: publish sanitized custom.97 source
This commit is contained in:
1022 files changed
+69903
-19207
No files matched your search
@@ -24,6 +24,33 @@ func TestTokenRoutingResolution(t *testing.T) {
|
||||
require.Equal(t, []TokenGroupEntry{{"a", 0}, {"b", 0}, {"c", 1}}, p.Resolve("MODEL-X", nil, allowed))
|
||||
}
|
||||
|
||||
func TestTokenRoutingBlacklistValidation(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
groups []string
|
||||
valid bool
|
||||
}{
|
||||
{"legacy", nil, true},
|
||||
{"empty", []string{}, true},
|
||||
{"unavailable group", []string{"removed-group"}, true},
|
||||
{"empty name", []string{""}, false},
|
||||
{"virtual auto", []string{"auto"}, false},
|
||||
{"leading space", []string{" default"}, false},
|
||||
{"trailing space", []string{"default "}, false},
|
||||
{"duplicate", []string{"default", "default"}, false},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
policy := TokenRoutingPolicy{Version: 1, Mode: "smart", ExcludedGroups: test.groups}
|
||||
err := policy.Validate(5, func(string) bool { return false })
|
||||
if test.valid {
|
||||
require.NoError(t, err)
|
||||
} else {
|
||||
require.Error(t, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestTokenRoutingLegacy(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
token Token
|
||||
|
||||
Reference in new issue
Block a user